本文整理汇总了Python中subscriber.Subscriber.lastname方法的典型用法代码示例。如果您正苦于以下问题:Python Subscriber.lastname方法的具体用法?Python Subscriber.lastname怎么用?Python Subscriber.lastname使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类subscriber.Subscriber
的用法示例。
在下文中一共展示了Subscriber.lastname方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_subscription_counter
# 需要导入模块: from subscriber import Subscriber [as 别名]
# 或者: from subscriber.Subscriber import lastname [as 别名]
def test_subscription_counter(self):
"""Test subscription counter retrieval"""
sub = Subscriber()
sub.lastname = 'toto'
sub.save()
sub = Subscriber()
sub.lastname = 'titi'
sub.save()
sub = Subscriber()
sub.lastname = 'tata'
sub.save()
self.assertEqual(3, Subscriber.get_count())
示例2: test_subscriber_without_remaining_issue
# 需要导入模块: from subscriber import Subscriber [as 别名]
# 或者: from subscriber.Subscriber import lastname [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()
示例3: test_field_length
# 需要导入模块: from subscriber import Subscriber [as 别名]
# 或者: from subscriber.Subscriber import lastname [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)
示例4: test_subscription_info_by_lastname
# 需要导入模块: from subscriber import Subscriber [as 别名]
# 或者: from subscriber.Subscriber import lastname [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'])
示例5: test_non_ascii_char
# 需要导入模块: from subscriber import Subscriber [as 别名]
# 或者: from subscriber.Subscriber import lastname [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)
示例6: test_first_line
# 需要导入模块: from subscriber import Subscriber [as 别名]
# 或者: from subscriber.Subscriber import lastname [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')
示例7: test_update_mail_sent
# 需要导入模块: from subscriber import Subscriber [as 别名]
# 或者: from subscriber.Subscriber import lastname [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)
示例8: test_export_for_special_issues
# 需要导入模块: from subscriber import Subscriber [as 别名]
# 或者: from subscriber.Subscriber import lastname [as 别名]
def test_export_for_special_issues(self):
"""Test the function to export subscriber list to send special issue"""
subscriber = Subscriber()
subscriber.lastname = 'toto'
subscriber.hors_serie1 = 1
subscriber.hors_serie2 = 0
subscriber.hors_serie3 = 0
subscriber.save()
subscriber = Subscriber()
subscriber.lastname = 'tata'
subscriber.hors_serie1 = 0
subscriber.hors_serie2 = 1
subscriber.hors_serie3 = 0
subscriber.save()
self.exporter.do_export_special_issue()
self.__test_presence_toto_tata()
示例9: test_noexception_with_emtpy_string_postcode
# 需要导入模块: from subscriber import Subscriber [as 别名]
# 或者: from subscriber.Subscriber import lastname [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], '')
示例10: test_null_post_code_format
# 需要导入模块: from subscriber import Subscriber [as 别名]
# 或者: from subscriber.Subscriber import lastname [as 别名]
def test_null_post_code_format(self):
"""Test the postcode format when a null postcode is in db: 00000 is
ugly"""
sub = Subscriber()
sub.lastname = 'toto'
address = Address()
address.post_code = 0
sub.address = address
sub.save()
dict_list = SubscriberAdapter.get_subscribers_from_lastname('toto')
new_sub = dict_list[0]
self.assertEquals('', new_sub['post_code'])
示例11: test_subscriber_with_wrong_pricing_info
# 需要导入模块: from subscriber import Subscriber [as 别名]
# 或者: from subscriber.Subscriber import lastname [as 别名]
def test_subscriber_with_wrong_pricing_info(self):
"""Tests what happens when Subscriber has wrong or empty pricing
info"""
sub = Subscriber()
sub.lastname = 'toto'
sub.subscription_price = 'foo'
sub.membership_price = 'bar'
sub.save()
dict_list = SubscriberAdapter.get_subscribers_from_lastname('toto')
new_sub = dict_list[0]
self.assertEquals('0,00', new_sub['subscription_price'])
self.assertEquals('0,00', new_sub['membership_price'])
示例12: set_regular_subscriber
# 需要导入模块: from subscriber import Subscriber [as 别名]
# 或者: from subscriber.Subscriber import lastname [as 别名]
def set_regular_subscriber(self):
sub = Subscriber()
sub.lastname = 'Nom'
sub.firstname = 'Prenom'
sub.name_addition = 'NameAddition'
a = Address()
a.address1 = 'Adresse'
a.address2 = 'Addition'
a.post_code = 12345
a.city = 'Ville'
sub.address = a
return sub
示例13: test_create_and_delete_subscriber
# 需要导入模块: from subscriber import Subscriber [as 别名]
# 或者: from subscriber.Subscriber import lastname [as 别名]
def test_create_and_delete_subscriber(self):
sub = Subscriber()
sub.lastname = 'toto'
sub.save()
ident = sub.identifier
SubscriberAdapter.delete_from_id(ident)
actual_result_count = len(
Subscriber.get_subscribers_from_lastname('toto')
)
self.assertEqual(0, actual_result_count)
示例14: test_mail_sent_updated_special_issue
# 需要导入模块: from subscriber import Subscriber [as 别名]
# 或者: from subscriber.Subscriber import lastname [as 别名]
def test_mail_sent_updated_special_issue(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.hors_serie1 = 1
sub.save()
self.assertEqual(0, sub.mail_sent)
示例15: test_when_mail_already_sent
# 需要导入模块: from subscriber import Subscriber [as 别名]
# 或者: from subscriber.Subscriber import lastname [as 别名]
def test_when_mail_already_sent(self):
"""Tests that a subscriber is not exported when he has already reveived
a resubscription mail and has not re subscribed"""
sub = Subscriber()
sub.lastname = 'toto'
sub.issues_to_receive = 0
sub.hors_serie1 = 0
sub.mail_sent = 1
sub.save()
self.exporter.do_export()
f = open_test_file()
self.assertEquals(1, len(f.readlines()))