当前位置: 首页>>代码示例>>Python>>正文


Python test_factory.Factory类代码示例

本文整理汇总了Python中test_factory.Factory的典型用法代码示例。如果您正苦于以下问题:Python Factory类的具体用法?Python Factory怎么用?Python Factory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Factory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: add_a_donation

    def add_a_donation(self, amount=None, date=None, type=None, notes=None, in_honor=False, in_memory=False, honorarium_name=None):
        sel = self.selenium
        self.switch_to_donor_tab()
        if not amount:
            amount = "%.2f" % (Factory.rand_currency())
        if not date:
            d = Factory.rand_date()
            date = "%02d/%02d/%02d" % (d.month, d.day, d.year)
        sel.click("css=tabbed_box[name=add_a_donation] tab_title")
        sel.type("css=#id_amount", amount)
        sel.type("css=#id_date", date)
        if type:
            sel.select("css=#id_type",type)
        if notes:
            sel.type("css=#id_notes", notes)

        if in_honor:
            sel.click("css=#id_in_honor_of")
        
        if in_memory:
            sel.click("css=#id_in_memory_of")
        
        if honorarium_name:
            sel.type("css=#id_honorarium_name", honorarium_name)

        sel.click("css=tabbed_box[name=add_a_donation] .add_donation_btn")
        time.sleep(2)
        return amount,date
开发者ID:skoczen,项目名称:mycelium,代码行数:28,代码来源:selenium_abstractions.py

示例2: test_challenge_has_set_up_tags

    def test_challenge_has_set_up_tags(self):
        # needed since the setup creates some and I don't want to add it to all the other tests.
        Tag.objects_by_account(self.a1).delete()

        self.a1.check_challenge_progress()
        assert self.a1.challenge_has_set_up_tags == False
        Factory.tag_person(self.a1)
        self.a1.check_challenge_progress()
        assert self.a1.challenge_has_set_up_tags == True
开发者ID:skoczen,项目名称:mycelium,代码行数:9,代码来源:unit_tests.py

示例3: test__detect_type

    def test__detect_type(self):
        fh = Factory.people_mailing_list_spreadsheet_file(self.a1, file_type=CSV_TYPE)
        s = SpreadsheetAbstraction(self.a1, fh, "people", filename="test.foo")
        self.assertEqual(s.type, CSV_TYPE)
        self.assertEqual(s.is_valid,True)
        

        fh = Factory.people_mailing_list_spreadsheet_file(self.a1, file_type=EXCEL_TYPE)
        s = SpreadsheetAbstraction(self.a1, fh, "people", filename="test.bar")
        self.assertEqual(s.type, EXCEL_TYPE)
        self.assertEqual(s.is_valid,True)
开发者ID:skoczen,项目名称:mycelium,代码行数:11,代码来源:unit_tests.py

示例4: test_that_after_signup_users_can_change_their_billing_info

    def test_that_after_signup_users_can_change_their_billing_info(self):
        # And see it updated.
        sel = self.selenium
        self.get_logged_in()
        self.go_to_the_account_page()

        self.enter_billing_info_signup()
        assert sel.is_text_present("XXXX-XXXX-XXXX-%s" % (Factory.test_cc_number(True)[-4:]))
        
        self.enter_billing_info_signup(cc_number="4222222222222")
        assert not sel.is_text_present("XXXX-XXXX-XXXX-%s" % (Factory.test_cc_number(True)[-4:]))
        assert sel.is_text_present("XXXX-XXXX-XXXX-2222")
开发者ID:skoczen,项目名称:mycelium,代码行数:12,代码来源:selenium_tests.py

示例5: test_creating_and_deleting_an_account_does_so_successfully

 def test_creating_and_deleting_an_account_does_so_successfully(self):
     from django.contrib.auth.models import User
     a1 = Factory.create_demo_site("test1", quick=True, create_subscription=True)
     a2 = Factory.create_demo_site("test2", quick=True)
     a1.delete()
     time.sleep(5)
     a3 = Factory.create_demo_site("test3", quick=True)
     a3.delete()
     self.assertEqual(Account.objects.all().count(), 1)
     self.assertEqual(User.objects.all().count(), 3)
     a2.delete()
     self.assertEqual(Account.objects.all().count(), 0)
     self.assertEqual(User.objects.all().count(), 0)
开发者ID:skoczen,项目名称:mycelium,代码行数:13,代码来源:unit_tests.py

示例6: test_that_a_new_person_in_account_1_does_not_show_in_account_2_org_people_search

    def test_that_a_new_person_in_account_1_does_not_show_in_account_2_org_people_search(self):
        sel = self.selenium
        cache.clear()
        self.go_to_the_login_page()
        self.log_in()
        self.assert_login_succeeded()
        self.create_john_smith_and_verify()
        self.create_new_organization()
        sel.click("css=tabbed_box tab_title")
        time.sleep(0.5)
        sel.click("id_search_new_person")
        sel.type("id_search_new_person", "john")
        time.sleep(2)
        assert sel.is_text_present('John Smith')
        

        a2 = self.create_demo_site("test2")
        ua = Factory.useraccount(account=a2)
        self.set_site("test2")
        self.go_to_the_login_page("test2")
        self.log_in(ua=ua)
        self.assert_login_succeeded()        

        self.create_new_organization()
        sel.click("css=tabbed_box tab_title")
        time.sleep(0.5)
        sel.click("id_search_new_person")
        sel.type("id_search_new_person", "john")
        time.sleep(2)
        assert sel.is_text_present('No people found for search "john".')
开发者ID:skoczen,项目名称:mycelium,代码行数:30,代码来源:selenium_tests.py

示例7: add_a_conversation

    def add_a_conversation(self, body=None, date=None, type="in-person"):
        sel = self.selenium
        self.switch_to_conversation_tab()
        if not body:
            body = Factory.rand_str(500)
        if not date:
            d = Factory.rand_date()
            date = "%02d/%02d/%02d" % (d.month, d.day, d.year)

        sel.click("css=tabbed_box[name=add_a_conversation] tab_title")
        sel.type("css=#id_body", body)
        sel.click("css=input[name=conversation_type][value=%s]" % (type,))
        sel.type("css=#id_date", date)
        sel.click("css=tabbed_box[name=add_a_conversation] .add_conversation_btn")
        time.sleep(2)
        return body,date
开发者ID:skoczen,项目名称:mycelium,代码行数:16,代码来源:selenium_abstractions.py

示例8: test_num_volunteer_hours

    def test_num_volunteer_hours(self):
        a = Factory.create_demo_site("test", quick=True)
        hours = 0
        for c in CompletedShift.objects.all():
            hours += c.duration

        self.assertEqual(a.num_volunteer_hours, hours)
开发者ID:skoczen,项目名称:mycelium,代码行数:7,代码来源:unit_tests.py

示例9: test_completed_shifts_by_year_returns_sanely

def test_completed_shifts_by_year_returns_sanely():
    account = Factory.account()
    person = Factory.person(account)
    today = datetime.date.today()
    
    
    s1 = CompletedShift.raw_objects.create(account=account, volunteer=person.volunteer, duration=5, date=today)
    s2 = CompletedShift.raw_objects.create(account=account, volunteer=person.volunteer, duration=1, date=today)

    target = [{'shifts': [s2, s1],
          'total_hours': s1.duration+s2.duration,
          'total_shifts': 2,
          'year': today.year
    }]
    
    assert person.volunteer.completed_shifts_by_year == target
开发者ID:skoczen,项目名称:mycelium,代码行数:16,代码来源:unit_tests.py

示例10: created_and_imported_excel_spreadsheet

    def created_and_imported_excel_spreadsheet(self, **kwargs):
        fh = Factory.people_mailing_list_spreadsheet_file(self.a1, file_type=EXCEL_TYPE, **kwargs)

        # import it
        fh.seek(0)
        s = SpreadsheetAbstraction(self.a1, fh, "people", filename="test.xls")
        self.assertEqual(s.is_valid,True)
        return s
开发者ID:skoczen,项目名称:mycelium,代码行数:8,代码来源:abstractions.py

示例11: test_challenge_has_added_board

 def test_challenge_has_added_board(self):
     Factory.tag(self.a1, name="Board of Directors")
     bg = Factory.group(self.a1,"board of directors")
     Factory.grouprule(self.a1, "have any tag that","contains","Board of Directors", group=bg)
     Factory.tag_person(self.a1, tag_name="Board of Directors")
     self.a1.check_challenge_progress()
     assert self.a1.challenge_has_added_board == True
开发者ID:skoczen,项目名称:mycelium,代码行数:7,代码来源:unit_tests.py

示例12: test_queryset_for_new_group_rule_for_last_volunteer_shift_is_on

    def test_queryset_for_new_group_rule_for_last_volunteer_shift_is_on(self):
        # create a new group rule (and TagSet)
        group, group_rule = self.test_create_new_group_rule_for_last_volunteer_shift_is_on()

        # hand-create a few people, some of whom match, and others who don't
        ppl = self._generate_people()
        target_date = datetime.date(month=3,day=24,year=2010)
        Factory.completed_volunteer_shift(ppl[2], date=target_date)
        Factory.completed_volunteer_shift(ppl[4], date=target_date)

        # assert the queryset string is right
        self.assertEqual(group_rule.queryset_filter_string, "filter(volunteer__completedshift__date=datetime.date(month=3,day=24,year=2010))")

        # get the queryset, make sure it matches a hand-created one.
        qs = group.members
    
        hand_qs = Person.objects_by_account(self.account).filter(Q(pk=ppl[2].pk) | Q(pk=ppl[4].pk) )
        self.assertEqualQuerySets(qs,hand_qs)
开发者ID:skoczen,项目名称:mycelium,代码行数:18,代码来源:unit_tests.py

示例13: test_that_new_signups_can_sign_up_for_an_account

    def test_that_new_signups_can_sign_up_for_an_account(self):
        sel = self.selenium
        self.get_logged_in()
        self.go_to_the_account_page()
        self.enter_billing_info_signup()

        assert sel.is_text_present("Status: Free Trial")
        assert sel.is_text_present("XXXX-XXXX-XXXX-%s" % (Factory.test_cc_number(True)[-4:]))
        assert sel.is_text_present("Signup Date: %s" % (date(datetime.date.today()),) )
        assert sel.is_element_present("link=Update Billing Information")
开发者ID:skoczen,项目名称:mycelium,代码行数:10,代码来源:selenium_tests.py

示例14: test_deleting_an_account_cancels_its_subscription

    def test_deleting_an_account_cancels_its_subscription(self):
        a1 = Factory.create_demo_site("test1", quick=True, create_subscription=True)
        stripe_id = a1.stripe_customer_id
        c = self.stripe.Customer.retrieve(stripe_id)
        assert hasattr(c, "subscription")
        
        a1.delete()

        c = self.stripe.Customer.retrieve(stripe_id)
        assert not hasattr(c, "subscription")
开发者ID:skoczen,项目名称:mycelium,代码行数:10,代码来源:unit_tests.py

示例15: test_saving_a_blank_group_gives_it_a_filler_name

 def test_saving_a_blank_group_gives_it_a_filler_name(self):
     account = Factory.account()
     ts = TagSet.raw_objects.create(account=account)
     self.assertEqual(ts.name,BLANK_TAGSET_NAME)
     ts.name = "foo"
     ts.save()
     self.assertEqual(ts.name,"foo") 
     ts.name = ""
     ts.save()
     self.assertEqual(ts.name,BLANK_TAGSET_NAME)
开发者ID:skoczen,项目名称:mycelium,代码行数:10,代码来源:unit_tests.py


注:本文中的test_factory.Factory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。