本文整理汇总了Python中bluebottle.test.factory_models.projects.ProjectFactory.save方法的典型用法代码示例。如果您正苦于以下问题:Python ProjectFactory.save方法的具体用法?Python ProjectFactory.save怎么用?Python ProjectFactory.save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bluebottle.test.factory_models.projects.ProjectFactory
的用法示例。
在下文中一共展示了ProjectFactory.save方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestProjectStatusUpdate
# 需要导入模块: from bluebottle.test.factory_models.projects import ProjectFactory [as 别名]
# 或者: from bluebottle.test.factory_models.projects.ProjectFactory import save [as 别名]
class TestProjectStatusUpdate(BluebottleTestCase):
"""
save() automatically updates some fields, specifically
the status field. Make sure it picks the right one
"""
def setUp(self):
super(TestProjectStatusUpdate, self).setUp()
self.init_projects()
self.theme = ProjectThemeFactory(slug='test-theme')
self.project = ProjectFactory(theme=self.theme)
self.task = TaskFactory(project=self.project)
self.survey = SurveyFactory(link='https://example.com/survey/1/')
def test_survey_url(self):
url = urlparse(
Survey.url(self.task)
)
query = parse_qs(url.query)
self.assertEqual(url.netloc, 'example.com')
self.assertEqual(query['theme'], [self.theme.slug])
self.assertEqual(query['project_id'], [str(self.project.id)])
self.assertEqual(query['task_id'], [str(self.task.id)])
self.assertEqual(query['user_type'], ['task_member'])
def test_survey_url_no_survey(self):
self.survey.delete()
self.assertIsNone(Survey.url(self.task))
def test_survey_url_project(self):
url = urlparse(
Survey.url(self.project)
)
query = parse_qs(url.query)
self.assertEqual(url.netloc, 'example.com')
self.assertEqual(query['theme'], [self.theme.slug])
self.assertEqual(query['project_id'], [str(self.project.id)])
self.assertTrue('task_id' not in query)
def test_survey_url_user_type(self):
url = urlparse(
Survey.url(self.task, user_type='initiator'),
)
query = parse_qs(url.query)
self.assertEqual(url.netloc, 'example.com')
self.assertEqual(query['theme'], [self.theme.slug])
self.assertEqual(query['project_id'], [str(self.project.id)])
self.assertEqual(query['task_id'], [str(self.task.id)])
self.assertEqual(query['user_type'], ['initiator'])
def test_survey_url_no_celebration(self):
self.project.celebrate_results = False
self.project.save()
self.assertIsNone(Survey.url(self.project))