本文整理匯總了Python中mailsnake.MailSnake.listInterestGroupingAdd方法的典型用法代碼示例。如果您正苦於以下問題:Python MailSnake.listInterestGroupingAdd方法的具體用法?Python MailSnake.listInterestGroupingAdd怎麽用?Python MailSnake.listInterestGroupingAdd使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類mailsnake.MailSnake
的用法示例。
在下文中一共展示了MailSnake.listInterestGroupingAdd方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_pending_user_subscription
# 需要導入模塊: from mailsnake import MailSnake [as 別名]
# 或者: from mailsnake.MailSnake import listInterestGroupingAdd [as 別名]
def test_pending_user_subscription(self):
ms = MailSnake(settings.MAILCHIMP_API_KEY)
user = get_admin_user()
subscription = UserSubscription.objects.get(user=user)
delete_member(user)
ms.listInterestGroupingAdd(id=get_list_id(),
name="Test Interest Group",
type="checkboxes",
groups=["Option 1", "Option 2"])
# when a user signs up...
pending, c = PendingUserSubscription.objects.get_or_create(user=user)
optin_ip = getattr(settings, 'MAILCHIMP_TEST_IP', '184.106.168.48')
optin_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
pending.merge_vars = {
'OPTIN_IP': optin_ip,
'OPTIN_TIME': optin_time,
}
pending.save()
# when the user is activated, confirmed, etc.
pending.subscribe(double_optin=False)
subscription.sync()
self.assertEqual(optin_ip, subscription.optin_ip)
self.assertEqual(optin_time, subscription.optin_time)
self.assertTrue(subscription.is_subscribed())
pending.delete()