~abompard/mailman/subpolicy

« back to all changes in this revision

Viewing changes to src/mailman/app/tests/test_subscriptions.py

  • Committer: Barry Warsaw
  • Date: 2015-04-07 02:12:37 UTC
  • Revision ID: barry@list.org-20150407021237-teu8vyk6vhjr1vzo
Check pointing

Show diffs side-by-side

added added

removed removed

Lines of Context:
82
82
        self._anne = 'anne@example.com'
83
83
        self._user_manager = getUtility(IUserManager)
84
84
 
 
85
    def test_user_or_address_required(self):
 
86
        # The `subscriber` attribute must be a user or address.
 
87
        self.assertRaises(AssertionError, SubscriptionWorkflow,
 
88
                          self._mlist,
 
89
                          'not a user', False, False, False)
 
90
 
 
91
    def test_user_without_preferred_address_gets_one(self):
 
92
        # When subscribing a user without a preferred address, the first step
 
93
        # in the workflow is to give the user a preferred address.
 
94
        anne = self._user_manager.create_user(self._anne)
 
95
        self.assertIsNone(anne.preferred_address)
 
96
        workflow = SubscriptionWorkflow(self._mlist, anne, False, False, False)
 
97
        next(workflow)
 
98
        
 
99
 
85
100
    def test_preverified_address_joins_open_list(self):
86
101
        # The mailing list has an open subscription policy, so the subscriber
87
102
        # becomes a member with no human intervention.