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


Python ProjectFactory.create方法代码示例

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


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

示例1: setUp

# 需要导入模块: from tests.factories import ProjectFactory [as 别名]
# 或者: from tests.factories.ProjectFactory import create [as 别名]
    def setUp(self):
        # feincms page containing zipfelchappe app content
        self.page = Page.objects.create(title="Projects", slug="projects")
        ct = self.page.content_type_for(ApplicationContent)
        ct.objects.create(parent=self.page, urlconf_path=app_settings.ROOT_URLS)

        # Fixture Data for following tests
        self.project1 = ProjectFactory.create()
        self.project2 = ProjectFactory.create()
        self.user = UserFactory.create()
        self.admin = UserFactory.create(is_superuser=True, is_staff=True)
        self.reward = RewardFactory.create(project=self.project1, minimum=20.00, quantity=1)

        # Fresh Client for every test
        self.client = Client()
开发者ID:feinheit,项目名称:zipfelchappe,代码行数:17,代码来源:test_admin_views.py

示例2: _set_up_private_project_with_comment

# 需要导入模块: from tests.factories import ProjectFactory [as 别名]
# 或者: from tests.factories.ProjectFactory import create [as 别名]
 def _set_up_private_project_with_comment(self):
     self.private_project = ProjectFactory.create(is_public=False, creator=self.user, comment_level='private')
     self.private_project.add_contributor(self.contributor, save=True)
     self.wiki = NodeWikiFactory(node=self.private_project, user=self.user)
     self.comment = CommentFactory(node=self.private_project, target=Guid.load(self.wiki._id), user=self.user)
     self.private_url = '/{}comments/{}/'.format(API_BASE, self.comment._id)
     self.payload = self._set_up_payload(self.comment._id)
开发者ID:baylee-d,项目名称:osf.io,代码行数:9,代码来源:test_comment_detail.py

示例3: test_postfinance_max_duration

# 需要导入模块: from tests.factories import ProjectFactory [as 别名]
# 或者: from tests.factories.ProjectFactory import create [as 别名]
 def test_postfinance_max_duration(self):
     now = timezone.now()
     project = ProjectFactory.create(start=now)
     project.end = now + timedelta(days=31)
     self.assertRaises(ValidationError, project.full_clean)
     project.end = now + timedelta(days=29)
     project.full_clean()
开发者ID:acidjunk,项目名称:zipfelchappe,代码行数:9,代码来源:test_projects.py

示例4: _set_up_public_project_with_comment

# 需要导入模块: from tests.factories import ProjectFactory [as 别名]
# 或者: from tests.factories.ProjectFactory import create [as 别名]
 def _set_up_public_project_with_comment(self):
     self.public_project = ProjectFactory.create(is_public=True, creator=self.user)
     self.public_project.add_contributor(self.contributor, save=True)
     self.public_comment = CommentFactory(node=self.public_project, user=self.user)
     reply_target = Guid.load(self.public_comment._id)
     self.public_comment_reply = CommentFactory(node=self.public_project, target=reply_target, user=self.user)
     self.public_url = '/{}comments/{}/'.format(API_BASE, self.public_comment._id)
     self.public_comment_payload = self._set_up_payload(self.public_comment._id)
开发者ID:baylee-d,项目名称:osf.io,代码行数:10,代码来源:test_comment_detail.py

示例5: setUp

# 需要导入模块: from tests.factories import ProjectFactory [as 别名]
# 或者: from tests.factories.ProjectFactory import create [as 别名]
 def setUp(self):
     self.project = ProjectFactory.create()
     self.user = UserFactory.create()
     self.backer = BackerFactory.create(user=self.user)
     self.p1 = PledgeFactory.create(
         project=self.project,
         amount=10.00,
     )
开发者ID:acidjunk,项目名称:zipfelchappe,代码行数:10,代码来源:test_pledges.py

示例6: test_default_max_duration

# 需要导入模块: from tests.factories import ProjectFactory [as 别名]
# 或者: from tests.factories.ProjectFactory import create [as 别名]
 def test_default_max_duration(self):
     global payment_providers
     pf = payment_providers['postfinance']
     del payment_providers['postfinance']
     project = ProjectFactory.create()
     self.assertEqual(app_settings.MAX_PROJECT_DURATION_DAYS, 120)
     project.end = timezone.now() + timedelta(days=121)
     self.assertRaises(ValidationError, project.full_clean)
     project.end = timezone.now() + timedelta(days=119)
     project.full_clean()
     payment_providers['postfinance'] = pf
开发者ID:acidjunk,项目名称:zipfelchappe,代码行数:13,代码来源:test_projects.py

示例7: _set_up_public_project_comment_reports

# 需要导入模块: from tests.factories import ProjectFactory [as 别名]
# 或者: from tests.factories.ProjectFactory import create [as 别名]
 def _set_up_public_project_comment_reports(self, comment_level='public'):
     self.public_project = ProjectFactory.create(is_public=True, creator=self.user, comment_level=comment_level)
     self.public_project.add_contributor(contributor=self.contributor, save=True)
     self.public_comment = CommentFactory.build(node=self.public_project, user=self.contributor)
     self.public_comment.reports = self.public_comment.reports or {}
     self.public_comment.reports[self.user._id] = {
         'category': 'spam',
         'text': 'This is spam',
         'date': datetime.utcnow(),
         'retracted': False,
     }
     self.public_comment.save()
     self.public_url = '/{}comments/{}/reports/'.format(API_BASE, self.public_comment._id)
开发者ID:DanielSBrown,项目名称:osf.io,代码行数:15,代码来源:test_comment_report_list.py

示例8: setUp

# 需要导入模块: from tests.factories import ProjectFactory [as 别名]
# 或者: from tests.factories.ProjectFactory import create [as 别名]
    def setUp(self):
        self.project = ProjectFactory.create()

        self.p1 = PledgeFactory.create(
            project=self.project,
            amount=10.00,
        )

        self.p2 = PledgeFactory.create(
            project=self.project,
            amount=20.00,
            anonymously=True
        )
开发者ID:acidjunk,项目名称:zipfelchappe,代码行数:15,代码来源:test_projects.py

示例9: _set_up_private_project_file_comment_reports

# 需要导入模块: from tests.factories import ProjectFactory [as 别名]
# 或者: from tests.factories.ProjectFactory import create [as 别名]
 def _set_up_private_project_file_comment_reports(self):
     self.private_project = ProjectFactory.create(is_public=False, creator=self.user)
     self.private_project.add_contributor(contributor=self.contributor, save=True)
     self.file = test_utils.create_test_file(self.private_project, self.user)
     self.comment = CommentFactory.build(node=self.private_project, target=self.file.get_guid(), user=self.contributor)
     self.comment.reports = self.comment.reports or {}
     self.comment.reports[self.user._id] = {
         'category': 'spam',
         'text': 'This is spam',
         'date': datetime.utcnow(),
         'retracted': False,
     }
     self.comment.save()
     self.private_url = '/{}comments/{}/reports/'.format(API_BASE, self.comment._id)
开发者ID:DanielSBrown,项目名称:osf.io,代码行数:16,代码来源:test_comment_report_list.py

示例10: _set_up_public_project_with_comment

# 需要导入模块: from tests.factories import ProjectFactory [as 别名]
# 或者: from tests.factories.ProjectFactory import create [as 别名]
 def _set_up_public_project_with_comment(self):
     self.public_project = ProjectFactory.create(is_public=True, creator=self.user)
     self.public_project.add_contributor(self.contributor, save=True)
     self.public_comment = CommentFactory(node=self.public_project, user=self.user)
     self.public_url = '/{}comments/{}/'.format(API_BASE, self.public_comment._id)
     self.public_comment_payload = {
         'data': {
             'id': self.public_comment._id,
             'type': 'comments',
             'attributes': {
                 'content': 'Updating this comment',
                 'deleted': False
             }
         }
     }
开发者ID:DanielSBrown,项目名称:osf.io,代码行数:17,代码来源:test_comment_detail.py

示例11: test_serialize_private_node

# 需要导入模块: from tests.factories import ProjectFactory [as 别名]
# 或者: from tests.factories.ProjectFactory import create [as 别名]
    def test_serialize_private_node(self):
        user = UserFactory()
        auth = Auth(user=user)
        public = ProjectFactory.create(is_public=True)
        # Add contributor with write permissions to avoid admin permission cascade
        public.add_contributor(user, permissions=['read', 'write'])
        public.save()
        private = ProjectFactory(parent=public, is_public=False)
        NodeFactory(parent=private)
        collector = rubeus.NodeFileCollector(node=public, auth=auth)

        private_dummy = collector._serialize_node(private)
        assert_false(private_dummy['permissions']['edit'])
        assert_false(private_dummy['permissions']['view'])
        assert_equal(private_dummy['name'], 'Private Component')
        assert_equal(len(private_dummy['children']), 0)
开发者ID:DanielSBrown,项目名称:osf.io,代码行数:18,代码来源:test_rubeus.py

示例12: setUp

# 需要导入模块: from tests.factories import ProjectFactory [as 别名]
# 或者: from tests.factories.ProjectFactory import create [as 别名]
    def setUp(self):
        # feincms page containing zipfelchappe app content
        self.page = Page.objects.create(title='Projects', slug='projects', override_url='/')
        ct = self.page.content_type_for(ApplicationContent)
        ct.objects.create(parent=self.page, urlconf_path=app_settings.ROOT_URLS)

        self.project = ProjectFactory.create()
        self.p1 = PledgeFactory.create(
            project=self.project,
            amount=10,
            provider='postfinance'
        )
        self.user = UserFactory.create(
            first_name='Hans',
            last_name='Muster'
        )
        self.p1.backer.user = self.user
        self.p1.backer.save()
        self.client = self.get_client_with_session()
开发者ID:acidjunk,项目名称:zipfelchappe,代码行数:21,代码来源:test_cod.py

示例13: setUp

# 需要导入模块: from tests.factories import ProjectFactory [as 别名]
# 或者: from tests.factories.ProjectFactory import create [as 别名]
    def setUp(self):

        super(TestRubeus, self).setUp()

        self.project = ProjectFactory.create()
        self.consolidated_auth = Auth(user=self.project.creator)
        self.non_authenticator = UserFactory()
        self.project.save()
        self.project.add_contributor(
            contributor=self.non_authenticator,
            auth=self.consolidated_auth,
        )
        self.project.add_addon('s3', self.consolidated_auth)
        self.project.creator.add_addon('s3', self.consolidated_auth)
        self.node_settings = self.project.get_addon('s3')
        self.user_settings = self.project.creator.get_addon('s3')
        self.user_settings.access_key = 'We-Will-Rock-You'
        self.user_settings.secret_key = 'Idontknowanyqueensongs'
        self.node_settings.bucket = 'Sheer-Heart-Attack'
        self.node_settings.user_settings = self.user_settings
        self.node_settings.save()
开发者ID:DanielSBrown,项目名称:osf.io,代码行数:23,代码来源:test_rubeus.py

示例14: setUp

# 需要导入模块: from tests.factories import ProjectFactory [as 别名]
# 或者: from tests.factories.ProjectFactory import create [as 别名]
    def setUp(self):
        self.project = ProjectFactory.create()

        self.reward = RewardFactory.create(
            project=self.project,
            minimum=20.00,
            quantity=5
        )

        self.p1 = PledgeFactory.create(
            project=self.project,
            amount=25.00,
            reward=self.reward
        )

        # Payment is not saved yet
        self.p2 = PledgeFactory.build(
            project=self.project,
            amount=20.00,
            reward=self.reward
        )
开发者ID:acidjunk,项目名称:zipfelchappe,代码行数:23,代码来源:test_rewards.py


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