本文整理汇总了Python中subscriber.Subscriber.issues_to_receive方法的典型用法代码示例。如果您正苦于以下问题:Python Subscriber.issues_to_receive方法的具体用法?Python Subscriber.issues_to_receive怎么用?Python Subscriber.issues_to_receive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类subscriber.Subscriber
的用法示例。
在下文中一共展示了Subscriber.issues_to_receive方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_subscriber_without_remaining_issue
# 需要导入模块: from subscriber import Subscriber [as 别名]
# 或者: from subscriber.Subscriber import issues_to_receive [as 别名]
def test_subscriber_without_remaining_issue(self):
"""Test if a subscriber that has no issue left will not receive a free
number :)"""
subscriber = Subscriber()
subscriber.lastname = 'toto'
subscriber.issues_to_receive = 1
subscriber.save()
subscriber = Subscriber()
subscriber.lastname = 'tata'
subscriber.issues_to_receive = 0
subscriber.save()
self.exporter.do_export()
self.__test_presence_toto_tata()
示例2: test_empty_email
# 需要导入模块: from subscriber import Subscriber [as 别名]
# 或者: from subscriber.Subscriber import issues_to_receive [as 别名]
def test_empty_email(self):
"""Tests what appens when a subscriber has no email"""
subscriber = Subscriber()
subscriber.email_address = '[email protected]'
subscriber.issues_to_receive = 0
subscriber.save()
subscriber = Subscriber()
subscriber.email_address = ''
subscriber.issues_to_receive = 0
subscriber.save()
lines = self.export_and_get_lines()
self.assertEqual('[email protected]\n', lines)
示例3: test_mail_sent_updated
# 需要导入模块: from subscriber import Subscriber [as 别名]
# 或者: from subscriber.Subscriber import issues_to_receive [as 别名]
def test_mail_sent_updated(self):
sub = Subscriber()
sub.lastname = 'toto'
sub.issues_to_receive = 0
sub.hors_serie1 = 0
sub.mail_sent = 1
sub.save()
self.assertEqual(1, sub.mail_sent)
sub.issues_to_receive = 1
sub.save()
self.assertEqual(0, sub.mail_sent)
示例4: test_two_email
# 需要导入模块: from subscriber import Subscriber [as 别名]
# 或者: from subscriber.Subscriber import issues_to_receive [as 别名]
def test_two_email(self):
"""Tests when we have two emails in generated file"""
subscriber = Subscriber()
subscriber.email_address = '[email protected]'
subscriber.issues_to_receive = 0
subscriber.save()
subscriber = Subscriber()
subscriber.email_address = '[email protected]'
subscriber.issues_to_receive = 0
subscriber.save()
lines = self.export_and_get_lines()
self.assertEqual('[email protected]\[email protected]\n', lines)
示例5: test_subscription_info_by_lastname
# 需要导入模块: from subscriber import Subscriber [as 别名]
# 或者: from subscriber.Subscriber import issues_to_receive [as 别名]
def test_subscription_info_by_lastname(self):
"""Test subscription info fields retrieved by the adapter"""
sub = Subscriber()
sub.lastname = 'toto'
sub.subscription_date = date(2011, 10, 10)
sub.issues_to_receive = 5
sub.subs_beginning_issue = 32
sub.subscription_price = 31.50
sub.membership_price = 50.25
sub.hors_serie1 = 1
sub.ordering_type = 'pp'
sub.comment = 'blahblah'
sub.save()
dict_list = SubscriberAdapter.get_subscribers_from_lastname('toto')
new_sub = dict_list[0]
self.assertEquals('10/10/2011', new_sub['subscription_date'])
self.assertEquals('5', new_sub['issues_to_receive'])
self.assertEquals('32', new_sub['subs_beginning_issue'])
self.assertEquals('31,50', new_sub['subscription_price'])
self.assertEquals('50,25', new_sub['membership_price'])
self.assertEquals('1', new_sub['hors_serie1'])
self.assertEquals('pp', new_sub['ordering_type'])
self.assertEquals('blahblah', new_sub['comment'])
self.assertEquals(sub.identifier, new_sub['subscriber_id'])
示例6: test_field_length
# 需要导入模块: from subscriber import Subscriber [as 别名]
# 或者: from subscriber.Subscriber import issues_to_receive [as 别名]
def test_field_length(self):
"""test if the fields in the output file does not exceed character limits"""
big_string = ''.join(['b' for i in xrange(1, 40)])
subscriber = Subscriber()
subscriber.lastname = big_string
subscriber.firstname = big_string
subscriber.company = big_string
a = Address()
a.address1 = big_string
a.address2 = big_string
a.post_code = 123456
a.city = big_string
subscriber.address = a
subscriber.issues_to_receive = 10
subscriber.save()
line = self.export_and_get_first_line()
splitted_line = line.split('\t')
self.assertTrue(len(splitted_line[0]) <= 20)
self.assertTrue(len(splitted_line[1]) <= 12)
self.assertTrue(len(splitted_line[2]) <= 32)
self.assertTrue(len(splitted_line[3]) <= 20)
self.assertTrue(len(splitted_line[4]) <= 32)
self.assertTrue(len(splitted_line[5]) <= 32)
self.assertTrue(len(splitted_line[6]) <= 32)
self.assertTrue(len(splitted_line[7]) <= 32)
self.assertTrue(len(splitted_line[8]) <= 5)
self.assertTrue(len(splitted_line[9]) <= 26)
self.assertTrue(len(splitted_line[10]) <= 8)
self.assertTrue(len(splitted_line[11]) <= 3)
self.assertTrue(len(splitted_line[12]) <= 32)
self.assertTrue(len(splitted_line[13]) <= 32)
self.assertTrue(len(splitted_line[14]) <= 32)
self.assertTrue(len(splitted_line[15]) <= 32)
示例7: test_first_line
# 需要导入模块: from subscriber import Subscriber [as 别名]
# 或者: from subscriber.Subscriber import issues_to_receive [as 别名]
def test_first_line(self):
"""Test if the first line of generated file is well written"""
subs = Subscriber()
subs.lastname = 'Debelle'
subs.firstname = 'Anne'
a = Address()
a.address1 = 'rue dupre 63'
a.address2 = 'Bruxelles 1090'
a.city = 'belgique'
subs.address = a
subs.issues_to_receive = 1
subs.save()
line = self.export_and_get_first_line()
self.assertTrue(line is not None)
splitted_line = line.split('\t')
self.assertEquals(splitted_line[2], u'DEBELLE')
self.assertEquals(splitted_line[3], u'ANNE')
self.assertEquals(splitted_line[4], u'')
self.assertEquals(splitted_line[5], u'')
self.assertEquals(splitted_line[6], u'RUE DUPRE 63')
self.assertEquals(splitted_line[7], u'BRUXELLES 1090')
self.assertEquals(splitted_line[8], u'')
self.assertEquals(splitted_line[9], u'BELGIQUE')
self.assertEquals(splitted_line[10], u'')
self.assertEquals(splitted_line[11], u'')
self.assertEquals(splitted_line[12], u'')
self.assertEquals(splitted_line[13], u'')
self.assertEquals(splitted_line[14], u'')
self.assertEquals(splitted_line[15], u'\n')
示例8: test_non_ascii_char
# 需要导入模块: from subscriber import Subscriber [as 别名]
# 或者: from subscriber.Subscriber import issues_to_receive [as 别名]
def test_non_ascii_char(self):
subscriber = Subscriber()
subscriber.lastname = u'Toto°°'
subscriber.issues_to_receive = 1
subscriber.save()
line = get_first_line()
self.assertTrue(line is not None)
示例9: test_update_mail_sent
# 需要导入模块: from subscriber import Subscriber [as 别名]
# 或者: from subscriber.Subscriber import issues_to_receive [as 别名]
def test_update_mail_sent(self):
sub = Subscriber()
sub.lastname = 'toto'
sub.issues_to_receive = 0
sub.save()
sub = Subscriber()
sub.lastname = 'tata'
sub.issues_to_receive = 1
sub.save()
Subscriber.update_mail_sent()
toto = Subscriber.get_subscribers_from_lastname('toto')[0]
tata = Subscriber.get_subscribers_from_lastname('tata')[0]
self.assertEqual(1, toto.mail_sent)
self.assertEqual(0, tata.mail_sent)
示例10: test_email_in_lowercase
# 需要导入模块: from subscriber import Subscriber [as 别名]
# 或者: from subscriber.Subscriber import issues_to_receive [as 别名]
def test_email_in_lowercase(self):
"""Tests that in generated file, the emails are in lower case"""
subscriber = Subscriber()
subscriber.issues_to_receive = 0
subscriber.email_address = '[email protected]'
subscriber.save()
lines = self.export_and_get_lines()
self.assertEqual('[email protected]', lines.strip())
示例11: test_remaining_issues_subscriber
# 需要导入模块: from subscriber import Subscriber [as 别名]
# 或者: from subscriber.Subscriber import issues_to_receive [as 别名]
def test_remaining_issues_subscriber(self):
"""Tests when the subscriber has remaining issues"""
subs = Subscriber()
subs.issues_to_receive = 1
subs.email_address = '[email protected]'
subs.save()
lines = self.export_and_get_lines()
self.assertEqual('', lines)
示例12: test_one_email
# 需要导入模块: from subscriber import Subscriber [as 别名]
# 或者: from subscriber.Subscriber import issues_to_receive [as 别名]
def test_one_email(self):
"""Test retrieval of one subscriber's email"""
subscriber = Subscriber()
subscriber.issues_to_receive = 0
subscriber.email_address = '[email protected]'
subscriber.save()
lines = self.export_and_get_lines()
self.assertEqual('[email protected]', lines.strip())
示例13: test_subscriber_with_regular_and_special
# 需要导入模块: from subscriber import Subscriber [as 别名]
# 或者: from subscriber.Subscriber import issues_to_receive [as 别名]
def test_subscriber_with_regular_and_special(self):
"""Test when subscriber has both remaining regular and special issues"""
subs = Subscriber()
subs.issues_to_receive = 1
subs.hors_serie1 = 1
subs.email_address = '[email protected]'
subs.save()
lines = self.export_and_get_lines()
self.assertEqual('', lines)
示例14: init_company_subscriber_without_name
# 需要导入模块: from subscriber import Subscriber [as 别名]
# 或者: from subscriber.Subscriber import issues_to_receive [as 别名]
def init_company_subscriber_without_name(self):
"""Initialize a subscriber without name info but with company info."""
sub = Subscriber()
sub.company = 'Google'
a = Address()
a.address1 = 'Address'
a.city = 'USA'
sub.address = a
sub.issues_to_receive = 0
sub.save()
示例15: test_noexception_with_emtpy_string_postcode
# 需要导入模块: from subscriber import Subscriber [as 别名]
# 或者: from subscriber.Subscriber import issues_to_receive [as 别名]
def test_noexception_with_emtpy_string_postcode(self):
"""Test that former empty postcode leads to no export error exception"""
subscriber = Subscriber()
subscriber.lastname = 'toto'
subscriber.issues_to_receive = 1
a = Address()
a.post_code = 0
subscriber.address = a
subscriber.save()
line = self.export_and_get_first_line()
self.assertEqual(line.split('\t')[8], '')