9
9
# and change their mailing list auto-subscription settings.
10
10
>>> login('foo.bar@canonical.com')
12
# We'll need this throughout the test script.
13
>>> from canonical.launchpad.ftests import syncUpdate
15
12
>>> from lp.registry.tests.mailinglists_helper import (
16
13
... get_alternative_email, print_addresses)
17
14
>>> anne = factory.makePersonByName('Anne')
1420
1416
# the security context in order to set it.
1421
1417
>>> from zope.security.proxy import removeSecurityProxy
1422
1418
>>> removeSecurityProxy(list_seven).status = MailingListStatus.MODIFIED
1423
>>> syncUpdate(list_seven)
1424
1419
>>> list_seven.subscribe(teri)
1425
1420
>>> list_seven.unsubscribe(teri)
1427
1422
>>> removeSecurityProxy(list_seven).status = MailingListStatus.UPDATING
1428
>>> syncUpdate(list_seven)
1429
1423
>>> list_seven.subscribe(teri)
1430
1424
>>> list_seven.unsubscribe(teri)
1432
1426
>>> removeSecurityProxy(list_seven).status = MailingListStatus.MOD_FAILED
1433
>>> syncUpdate(list_seven)
1434
1427
>>> list_seven.subscribe(teri)
1435
1428
>>> list_seven.unsubscribe(teri)
1440
1433
# We don't need to test the INACTIVE state, as that's represented above.
1441
1434
>>> removeSecurityProxy(list_seven).status = MailingListStatus.REGISTERED
1442
>>> syncUpdate(list_seven)
1443
1435
>>> list_seven.subscribe(teri)
1444
1436
Traceback (most recent call last):
1446
1438
CannotSubscribe: Mailing list is not usable: Team 7
1448
1440
>>> removeSecurityProxy(list_seven).status = MailingListStatus.APPROVED
1449
>>> syncUpdate(list_seven)
1450
1441
>>> list_seven.subscribe(teri)
1451
1442
Traceback (most recent call last):
1453
1444
CannotSubscribe: Mailing list is not usable: Team 7
1455
1446
>>> removeSecurityProxy(list_seven).status = MailingListStatus.DECLINED
1456
>>> syncUpdate(list_seven)
1457
1447
>>> list_seven.subscribe(teri)
1458
1448
Traceback (most recent call last):
1460
1450
CannotSubscribe: Mailing list is not usable: Team 7
1462
1452
>>> removeSecurityProxy(list_seven).status = MailingListStatus.CONSTRUCTING
1463
>>> syncUpdate(list_seven)
1464
1453
>>> list_seven.subscribe(teri)
1465
1454
Traceback (most recent call last):
1467
1456
CannotSubscribe: Mailing list is not usable: Team 7
1469
1458
>>> removeSecurityProxy(list_seven).status = MailingListStatus.FAILED
1470
>>> syncUpdate(list_seven)
1471
1459
>>> list_seven.subscribe(teri)
1472
1460
Traceback (most recent call last):
1476
1464
>>> removeSecurityProxy(list_seven).status = (
1477
1465
... MailingListStatus.DEACTIVATING)
1478
>>> syncUpdate(list_seven)
1479
1466
>>> list_seven.subscribe(teri)
1480
1467
Traceback (most recent call last):