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


Python testcases.TestCase类代码示例

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


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

示例1: setUp

    def setUp(self):
        TestCase.setUp(self)

        self.bogus_user = bogus_user = get_user_model().objects.get(
            username='bogus')
        self.bogus_user2 = bogus_user2 = get_user_model().objects.get(
            username='bogus2')
        # start by resetting the feeds
        for u in [self.bogus_user, self.bogus_user2]:
            user_feed = feedly.get_user_feed(u.id)
            user_feed.delete()
            for name, feed in feedly.get_feeds(u.id).items():
                feed.delete()

        # login the user
        rf = RequestMock()
        self.rf = rf
        self.client = Client()
        self.auth_client = Client()
        self.auth_client2 = Client()
        auth_response = self.auth_client.login(
            username='bogus', password='bogus')
        self.assertTrue(auth_response)
        auth_response = self.auth_client2.login(
            username='bogus2', password='bogus')
        self.assertTrue(auth_response)
开发者ID:bmaeser,项目名称:Feedly,代码行数:26,代码来源:tests.py

示例2: assertDictContainsSubset

 def assertDictContainsSubset(self, a, b, *args):
     try:
         DjangoTestCase.assertDictContainsSubset(self, a, b, *args)
     except AttributeError:
         for key, value in a.items():
             self.assertTrue(key in b)
             self.assertEqual(b[key], value)
开发者ID:ABASystems,项目名称:django-celery,代码行数:7,代码来源:test_views.py

示例3: setUp

 def setUp(self):
     TestCase.setUp(self)
     self.rule = RuleFactory()
     self.rule.active = False
     self.rule.save()
     self.date = datetime.date(2012, 10, 29)
     self.appointment = AppointmentFactory.create(calendar__car=self.rule.car,
                                                  calendar__timeslot=self.rule.timeslot)
开发者ID:slspeek,项目名称:gnudok-planner,代码行数:8,代码来源:schedule_tests.py

示例4: setUp

 def setUp(self):
     TestCase.setUp(self)
     from core.models import Item
     print(Item.objects.all().count())
     self.client = Client()
     self.auth_client = Client()
     response = self.auth_client.login(username='admin', password='admin')
     self.assertTrue(response)
     self.admin = get_user_model().objects.get(username='admin')
     self.bogus = get_user_model().objects.get(username='bogus')
开发者ID:GetStream,项目名称:Stream-Example-Py,代码行数:10,代码来源:tests.py

示例5: assertIn

 def assertIn(self, expected, source, *args):
     try:
         DjangoTestCase.assertIn(self, expected, source, *args)
     except AttributeError:
         self.assertTrue(expected in source)
开发者ID:ABASystems,项目名称:django-celery,代码行数:5,代码来源:test_views.py

示例6: setUp

 def setUp(self):
     TestCase.setUp(self)
     self.user = User.objects.create_superuser('eytan', '[email protected]', 'test')
     login_successful = self.client.login(username="eytan",password="test")
     self.assertTrue(login_successful)
开发者ID:eytanbm,项目名称:service,代码行数:5,代码来源:testing.py

示例7: setUp

 def setUp(self):
     TestCase.setUp(self)
开发者ID:TriggeredMessaging,项目名称:django-mongoforms,代码行数:2,代码来源:tests.py

示例8: __init__

 def __init__(self):
     TestCase.__init__(self, methodName='stop')
开发者ID:Lucterios2,项目名称:contacts,代码行数:2,代码来源:test_tools.py

示例9: setUp

 def setUp(self):
     TestCase.setUp(self)
     self.sett = self.settings(**SETTINGS)
     self.sett.enable()
     assert self.client.login(username='sax', password='123')
开发者ID:GigiusB,项目名称:django-iadmin,代码行数:5,代码来源:common.py

示例10: __init__

 def __init__(self, method_name):
     self.ciprofloxacin = None
     TestCase.__init__(self, method_name)
开发者ID:adieyal,项目名称:sarpaminfohub,代码行数:3,代码来源:sarpam_test_case.py


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