本文整理汇总了Python中mailman.app.subscriptions.SubscriptionWorkflow.run_thru方法的典型用法代码示例。如果您正苦于以下问题:Python SubscriptionWorkflow.run_thru方法的具体用法?Python SubscriptionWorkflow.run_thru怎么用?Python SubscriptionWorkflow.run_thru使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mailman.app.subscriptions.SubscriptionWorkflow
的用法示例。
在下文中一共展示了SubscriptionWorkflow.run_thru方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_moderation_checks_approval_required
# 需要导入模块: from mailman.app.subscriptions import SubscriptionWorkflow [as 别名]
# 或者: from mailman.app.subscriptions.SubscriptionWorkflow import run_thru [as 别名]
def test_moderation_checks_approval_required(self):
# The moderator must approve the subscription.
self._mlist.subscription_policy = SubscriptionPolicy.moderate
anne = self._user_manager.create_address(self._anne)
workflow = SubscriptionWorkflow(self._mlist, anne, pre_verified=True)
workflow.run_thru('moderation_checks')
with patch.object(workflow, '_step_get_moderator_approval') as step:
next(workflow)
step.assert_called_once_with()
示例2: test_confirmation_checks_no_user_confirmation_needed
# 需要导入模块: from mailman.app.subscriptions import SubscriptionWorkflow [as 别名]
# 或者: from mailman.app.subscriptions.SubscriptionWorkflow import run_thru [as 别名]
def test_confirmation_checks_no_user_confirmation_needed(self):
# A subscription to a list which does not need user confirmation skips
# to the moderation checks.
self._mlist.subscription_policy = SubscriptionPolicy.moderate
anne = self._user_manager.create_address(self._anne)
workflow = SubscriptionWorkflow(self._mlist, anne, pre_verified=True)
workflow.run_thru('confirmation_checks')
with patch.object(workflow, '_step_moderation_checks') as step:
next(workflow)
step.assert_called_once_with()
示例3: test_confirmation_checks_confirmation_needed
# 需要导入模块: from mailman.app.subscriptions import SubscriptionWorkflow [as 别名]
# 或者: from mailman.app.subscriptions.SubscriptionWorkflow import run_thru [as 别名]
def test_confirmation_checks_confirmation_needed(self):
# The subscription policy requires confirmation and the subscription
# is not pre-confirmed.
self._mlist.subscription_policy = SubscriptionPolicy.confirm
anne = self._user_manager.create_address(self._anne)
workflow = SubscriptionWorkflow(self._mlist, anne, pre_verified=True)
workflow.run_thru('confirmation_checks')
with patch.object(workflow, '_step_send_confirmation') as step:
next(workflow)
step.assert_called_once_with()
示例4: test_verification_checks_with_verified_address
# 需要导入模块: from mailman.app.subscriptions import SubscriptionWorkflow [as 别名]
# 或者: from mailman.app.subscriptions.SubscriptionWorkflow import run_thru [as 别名]
def test_verification_checks_with_verified_address(self):
# When the address is already verified, we skip straight to the
# confirmation checks.
anne = self._user_manager.create_address(self._anne)
anne.verified_on = now()
workflow = SubscriptionWorkflow(self._mlist, anne)
workflow.run_thru('verification_checks')
with patch.object(workflow, '_step_confirmation_checks') as step:
next(workflow)
step.assert_called_once_with()
示例5: test_confirmation_checks_open_list
# 需要导入模块: from mailman.app.subscriptions import SubscriptionWorkflow [as 别名]
# 或者: from mailman.app.subscriptions.SubscriptionWorkflow import run_thru [as 别名]
def test_confirmation_checks_open_list(self):
# A subscription to an open list does not need to be confirmed or
# moderated.
self._mlist.subscription_policy = SubscriptionPolicy.open
anne = self._user_manager.create_address(self._anne)
workflow = SubscriptionWorkflow(self._mlist, anne, pre_verified=True)
workflow.run_thru('confirmation_checks')
with patch.object(workflow, '_step_do_subscription') as step:
next(workflow)
step.assert_called_once_with()
示例6: test_sanity_checks_address
# 需要导入模块: from mailman.app.subscriptions import SubscriptionWorkflow [as 别名]
# 或者: from mailman.app.subscriptions.SubscriptionWorkflow import run_thru [as 别名]
def test_sanity_checks_address(self):
# Ensure that the sanity check phase, when given an IAddress, ends up
# with a linked user.
anne = self._user_manager.create_address(self._anne)
workflow = SubscriptionWorkflow(self._mlist, anne)
self.assertIsNotNone(workflow.address)
self.assertIsNone(workflow.user)
workflow.run_thru('sanity_checks')
self.assertIsNotNone(workflow.address)
self.assertIsNotNone(workflow.user)
self.assertEqual(list(workflow.user.addresses)[0].email, self._anne)
示例7: test_verification_checks_with_pre_verified_address
# 需要导入模块: from mailman.app.subscriptions import SubscriptionWorkflow [as 别名]
# 或者: from mailman.app.subscriptions.SubscriptionWorkflow import run_thru [as 别名]
def test_verification_checks_with_pre_verified_address(self):
# When the address is not yet verified, but the pre-verified flag is
# passed to the workflow, we skip to the confirmation checks.
anne = self._user_manager.create_address(self._anne)
workflow = SubscriptionWorkflow(self._mlist, anne, pre_verified=True)
workflow.run_thru('verification_checks')
with patch.object(workflow, '_step_confirmation_checks') as step:
next(workflow)
step.assert_called_once_with()
# And now the address is verified.
self.assertIsNotNone(anne.verified_on)
示例8: test_sanity_checks_user_without_preferred_address
# 需要导入模块: from mailman.app.subscriptions import SubscriptionWorkflow [as 别名]
# 或者: from mailman.app.subscriptions.SubscriptionWorkflow import run_thru [as 别名]
def test_sanity_checks_user_without_preferred_address(self):
# Ensure that the sanity check phase, when given a user without a
# preferred address, but with at least one linked address, gets an
# address.
anne = self._user_manager.make_user(self._anne)
workflow = SubscriptionWorkflow(self._mlist, anne)
self.assertIsNone(workflow.address)
self.assertEqual(workflow.user, anne)
workflow.run_thru('sanity_checks')
self.assertIsNotNone(workflow.address)
self.assertEqual(workflow.user, anne)
示例9: test_verification_checks_confirmation_needed
# 需要导入模块: from mailman.app.subscriptions import SubscriptionWorkflow [as 别名]
# 或者: from mailman.app.subscriptions.SubscriptionWorkflow import run_thru [as 别名]
def test_verification_checks_confirmation_needed(self):
# The address is neither verified, nor is the pre-verified flag set.
# A confirmation message must be sent to the user which will also
# verify their address.
anne = self._user_manager.create_address(self._anne)
workflow = SubscriptionWorkflow(self._mlist, anne)
workflow.run_thru('verification_checks')
with patch.object(workflow, '_step_send_confirmation') as step:
next(workflow)
step.assert_called_once_with()
# The address still hasn't been verified.
self.assertIsNone(anne.verified_on)
示例10: test_confirmation_checks_confirm_and_moderate_pre_confirmed
# 需要导入模块: from mailman.app.subscriptions import SubscriptionWorkflow [as 别名]
# 或者: from mailman.app.subscriptions.SubscriptionWorkflow import run_thru [as 别名]
def test_confirmation_checks_confirm_and_moderate_pre_confirmed(self):
# The subscription policy requires user confirmation and moderation,
# but their subscription is pre-confirmed.
self._mlist.subscription_policy = \
SubscriptionPolicy.confirm_then_moderate
anne = self._user_manager.create_address(self._anne)
workflow = SubscriptionWorkflow(self._mlist, anne,
pre_verified=True,
pre_confirmed=True)
workflow.run_thru('confirmation_checks')
with patch.object(workflow, '_step_moderation_checks') as step:
next(workflow)
step.assert_called_once_with()
示例11: test_confirmation_checks_confirm_pre_confirmed
# 需要导入模块: from mailman.app.subscriptions import SubscriptionWorkflow [as 别名]
# 或者: from mailman.app.subscriptions.SubscriptionWorkflow import run_thru [as 别名]
def test_confirmation_checks_confirm_pre_confirmed(self):
# The subscription policy requires user confirmation, but their
# subscription is pre-confirmed. Since moderation is not required,
# the user will be immediately subscribed.
self._mlist.subscription_policy = SubscriptionPolicy.confirm
anne = self._user_manager.create_address(self._anne)
workflow = SubscriptionWorkflow(self._mlist, anne,
pre_verified=True,
pre_confirmed=True)
workflow.run_thru('confirmation_checks')
with patch.object(workflow, '_step_do_subscription') as step:
next(workflow)
step.assert_called_once_with()
示例12: test_sanity_checks_user_with_preferred_address
# 需要导入模块: from mailman.app.subscriptions import SubscriptionWorkflow [as 别名]
# 或者: from mailman.app.subscriptions.SubscriptionWorkflow import run_thru [as 别名]
def test_sanity_checks_user_with_preferred_address(self):
# Ensure that the sanity check phase, when given an IUser with a
# preferred address, ends up with an address.
anne = self._user_manager.make_user(self._anne)
address = set_preferred(anne)
workflow = SubscriptionWorkflow(self._mlist, anne)
# The constructor sets workflow.address because the user has a
# preferred address.
self.assertEqual(workflow.address, address)
self.assertEqual(workflow.user, anne)
workflow.run_thru('sanity_checks')
self.assertEqual(workflow.address, address)
self.assertEqual(workflow.user, anne)
示例13: test_pended_data
# 需要导入模块: from mailman.app.subscriptions import SubscriptionWorkflow [as 别名]
# 或者: from mailman.app.subscriptions.SubscriptionWorkflow import run_thru [as 别名]
def test_pended_data(self):
# There is a Pendable associated with the held request, and it has
# some data associated with it.
anne = self._user_manager.create_address(self._anne)
workflow = SubscriptionWorkflow(self._mlist, anne)
with suppress(StopIteration):
workflow.run_thru('send_confirmation')
self.assertIsNotNone(workflow.token)
pendable = getUtility(IPendings).confirm(workflow.token, expunge=False)
self.assertEqual(pendable['list_id'], 'test.example.com')
self.assertEqual(pendable['email'], '[email protected]')
self.assertEqual(pendable['display_name'], '')
self.assertEqual(pendable['when'], '2005-08-01T07:49:23')
self.assertEqual(pendable['token_owner'], 'subscriber')
示例14: test_sanity_checks_user_with_multiple_linked_addresses
# 需要导入模块: from mailman.app.subscriptions import SubscriptionWorkflow [as 别名]
# 或者: from mailman.app.subscriptions.SubscriptionWorkflow import run_thru [as 别名]
def test_sanity_checks_user_with_multiple_linked_addresses(self):
# Ensure that the santiy check phase, when given a user without a
# preferred address, but with multiple linked addresses, gets of of
# those addresses (exactly which one is undefined).
anne = self._user_manager.make_user(self._anne)
anne.link(self._user_manager.create_address('[email protected]'))
anne.link(self._user_manager.create_address('[email protected]'))
workflow = SubscriptionWorkflow(self._mlist, anne)
self.assertIsNone(workflow.address)
self.assertEqual(workflow.user, anne)
workflow.run_thru('sanity_checks')
self.assertIn(workflow.address.email, ['[email protected]',
'[email protected]',
'[email protected]'])
self.assertEqual(workflow.user, anne)
示例15: test_do_confirm_verify_address
# 需要导入模块: from mailman.app.subscriptions import SubscriptionWorkflow [as 别名]
# 或者: from mailman.app.subscriptions.SubscriptionWorkflow import run_thru [as 别名]
def test_do_confirm_verify_address(self):
# The address is not yet verified, nor are we pre-verifying. A
# confirmation message will be sent. When the user confirms their
# subscription request, the address will end up being verified.
anne = self._user_manager.create_address(self._anne)
self.assertIsNone(anne.verified_on)
# Run the workflow to model the confirmation step.
workflow = SubscriptionWorkflow(self._mlist, anne)
list(workflow)
# The address is still not verified.
self.assertIsNone(anne.verified_on)
confirm_workflow = SubscriptionWorkflow(self._mlist)
confirm_workflow.token = workflow.token
confirm_workflow.restore()
confirm_workflow.run_thru('do_confirm_verify')
# The address is now verified.
self.assertIsNotNone(anne.verified_on)