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


Python QuestionFactory.take方法代码示例

本文整理汇总了Python中kitsune.questions.tests.QuestionFactory.take方法的典型用法代码示例。如果您正苦于以下问题:Python QuestionFactory.take方法的具体用法?Python QuestionFactory.take怎么用?Python QuestionFactory.take使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在kitsune.questions.tests.QuestionFactory的用法示例。


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

示例1: test_take_twice_forced

# 需要导入模块: from kitsune.questions.tests import QuestionFactory [as 别名]
# 或者: from kitsune.questions.tests.QuestionFactory import take [as 别名]
 def test_take_twice_forced(self):
     u1 = UserFactory()
     u2 = UserFactory()
     q = QuestionFactory()
     q.take(u1)
     q.take(u2, force=True)
     eq_(q.taken_by, u2)
开发者ID:1234-,项目名称:kitsune,代码行数:9,代码来源:test_models.py

示例2: test_is_taken

# 需要导入模块: from kitsune.questions.tests import QuestionFactory [as 别名]
# 或者: from kitsune.questions.tests.QuestionFactory import take [as 别名]
 def test_is_taken(self):
     q = QuestionFactory()
     u = UserFactory()
     q.take(u)
     url = reverse('question-detail', args=[q.id])
     res = self.client.get(url)
     eq_(res.status_code, 200)
     eq_(res.data['taken_by']['username'], u.username)
开发者ID:Andisutra80,项目名称:kitsune,代码行数:10,代码来源:test_api.py

示例3: test_filter_taken_by_username

# 需要导入模块: from kitsune.questions.tests import QuestionFactory [as 别名]
# 或者: from kitsune.questions.tests.QuestionFactory import take [as 别名]
    def test_filter_taken_by_username(self):
        q1 = QuestionFactory()
        q2 = QuestionFactory()
        q2.take(q1.creator)

        url = reverse('question-list') + '?taken_by=' + q1.creator.username
        res = self.client.get(url)

        eq_(res.status_code, 200)
        eq_(res.data['count'], 1)
        eq_(res.data['results'][0]['id'], q2.id)
开发者ID:Andisutra80,项目名称:kitsune,代码行数:13,代码来源:test_api.py

示例4: test_filter_is_taken_false

# 需要导入模块: from kitsune.questions.tests import QuestionFactory [as 别名]
# 或者: from kitsune.questions.tests.QuestionFactory import take [as 别名]
    def test_filter_is_taken_false(self):
        q1 = QuestionFactory()
        q2 = QuestionFactory()
        q2.take(q1.creator)

        url = reverse('question-list') + '?is_taken=0'
        res = self.client.get(url)

        eq_(res.status_code, 200)
        eq_(res.data['count'], 1)
        eq_(res.data['results'][0]['id'], q1.id)
开发者ID:Andisutra80,项目名称:kitsune,代码行数:13,代码来源:test_api.py

示例5: test_taken_until_is_set

# 需要导入模块: from kitsune.questions.tests import QuestionFactory [as 别名]
# 或者: from kitsune.questions.tests.QuestionFactory import take [as 别名]
 def test_taken_until_is_set(self):
     u = UserFactory()
     q = QuestionFactory()
     q.take(u)
     assert q.taken_until > datetime.now()
开发者ID:1234-,项目名称:kitsune,代码行数:7,代码来源:test_models.py

示例6: test_take_twice_same_user_refreshes_time

# 需要导入模块: from kitsune.questions.tests import QuestionFactory [as 别名]
# 或者: from kitsune.questions.tests.QuestionFactory import take [as 别名]
 def test_take_twice_same_user_refreshes_time(self):
     u = UserFactory()
     first_taken_until = datetime.now() - timedelta(minutes=5)
     q = QuestionFactory(taken_by=u, taken_until=first_taken_until)
     q.take(u)
     ok_(q.taken_until > first_taken_until)
开发者ID:1234-,项目名称:kitsune,代码行数:8,代码来源:test_models.py

示例7: test_take_twice_fails

# 需要导入模块: from kitsune.questions.tests import QuestionFactory [as 别名]
# 或者: from kitsune.questions.tests.QuestionFactory import take [as 别名]
 def test_take_twice_fails(self):
     u1 = UserFactory()
     u2 = UserFactory()
     q = QuestionFactory()
     q.take(u1)
     q.take(u2)
开发者ID:1234-,项目名称:kitsune,代码行数:8,代码来源:test_models.py

示例8: test_take_creator

# 需要导入模块: from kitsune.questions.tests import QuestionFactory [as 别名]
# 或者: from kitsune.questions.tests.QuestionFactory import take [as 别名]
 def test_take_creator(self):
     q = QuestionFactory()
     q.take(q.creator)
开发者ID:1234-,项目名称:kitsune,代码行数:5,代码来源:test_models.py

示例9: test_take

# 需要导入模块: from kitsune.questions.tests import QuestionFactory [as 别名]
# 或者: from kitsune.questions.tests.QuestionFactory import take [as 别名]
 def test_take(self):
     u = UserFactory()
     q = QuestionFactory()
     q.take(u)
     eq_(q.taken_by, u)
     ok_(q.taken_until is not None)
开发者ID:1234-,项目名称:kitsune,代码行数:8,代码来源:test_models.py


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