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


Python model_factories.UserF类代码示例

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


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

示例1: setUp

    def setUp(self):
        self.factory = APIRequestFactory()
        self.admin = UserF.create()
        self.creator = UserF.create()
        self.viewer = UserF.create()
        self.project = ProjectF(
            add_admins=[self.admin],
            add_contributors=[self.creator]
        )

        self.contribution = ObservationFactory.create(
            **{'project': self.project, 'creator': self.creator}
        )

        self.viewer = UserF.create()
        self.grouping = GroupingFactory.create(
            add_viewers=[self.viewer],
            **{'project': self.project}
        )
        RuleFactory.create(**{
            'grouping': self.grouping,
            'category': self.contribution.category
        })

        self.image_file = ImageFileFactory.create(
            **{'contribution': self.contribution, 'creator': self.creator}
        )
开发者ID:IdahoInstitute,项目名称:geokey,代码行数:27,代码来源:test_views.py

示例2: test

    def test(self):
        creator = UserF.create()
        admin = UserF.create()
        project = ProjectF(add_admins=[admin])
        observation = ObservationFactory.create(**{
            'project': project,
            'creator': creator
        })
        comment = CommentFactory.create()

        factory = APIRequestFactory()
        url = reverse('api:myobservations_single_comment', kwargs={
            'project_id': project.id,
            'observation_id': observation.id,
            'comment_id': comment.id
        })
        request = factory.delete(url)
        force_authenticate(request, user=admin)
        view = MyContributionsSingleCommentAPIView.as_view()
        response = view(
            request,
            project_id=project.id,
            observation_id=observation.id,
            comment_id=comment.id
        ).render()

        self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)
开发者ID:IdahoInstitute,项目名称:geokey,代码行数:27,代码来源:test_views.py

示例3: setUp

    def setUp(self):
        self.factory = RequestFactory()
        self.admin = UserF.create()
        self.contributor = UserF.create()
        self.non_member = UserF.create()

        self.project = ProjectF.create(
            add_admins=[self.admin],
            add_contributors=[self.contributor]
        )
开发者ID:sfwatergit,项目名称:geokey,代码行数:10,代码来源:test_views.py

示例4: setUp

    def setUp(self):
        self.factory = APIRequestFactory()
        self.admin = UserF.create()
        self.contributor = UserF.create()
        self.non_member = UserF.create()

        self.project = ProjectF(
            add_admins=[self.admin],
            add_contributors=[self.contributor]
        )
        self.view = GroupingFactory(**{
            'project': self.project,
            'description': 'description'
        })
开发者ID:IdahoInstitute,项目名称:geokey,代码行数:14,代码来源:test_views.py

示例5: test_get_with_unconnected_user

 def test_get_with_unconnected_user(self):
     view = ApplicationDisconnect.as_view()
     url = reverse('admin:app_disconnect', kwargs={'app_id': self.app.id})
     request = APIRequestFactory().get(url)
     request.user = UserF.create()
     response = view(request, app_id=self.app.id)
     self.assertTrue(isinstance(response, HttpResponseRedirect))
开发者ID:IdahoInstitute,项目名称:geokey,代码行数:7,代码来源:test_views.py

示例6: setUp

 def setUp(self):
     self.user1 = UserF.create()
     self.user2 = UserF.create()
     self.app1 = ApplicationFactory(**{
         'creator': self.user1
     })
     self.app2 = ApplicationFactory(**{
         'creator': self.user1
     })
     self.app3 = ApplicationFactory(**{
         'creator': self.user2
     })
     self.deleted_app = ApplicationFactory(**{
         'creator': self.user1,
         'status': 'deleted'
     })
开发者ID:IdahoInstitute,项目名称:geokey,代码行数:16,代码来源:test_manager.py

示例7: test_add_comment_to_observation_with_view_member

 def test_add_comment_to_observation_with_view_member(self):
     view_member = UserF.create()
     GroupingFactory(add_viewers=[view_member], **{
         'project': self.project
     })
     response = self.get_response(view_member)
     self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)
开发者ID:IdahoInstitute,项目名称:geokey,代码行数:7,代码来源:test_views.py

示例8: test_get_with_user

 def test_get_with_user(self):
     view = ApplicationOverview.as_view()
     url = reverse('admin:app_overview')
     request = APIRequestFactory().get(url)
     request.user = UserF.create()
     response = view(request).render()
     self.assertEqual(response.status_code, 200)
开发者ID:IdahoInstitute,项目名称:geokey,代码行数:7,代码来源:test_views.py

示例9: test_for_viewer

 def test_for_viewer(self):
     observations = Observation.objects.all().for_viewer(UserF.create())
     self.assertEqual(len(observations), 5)
     for observation in observations:
         self.assertNotIn(
             observation.status,
             ['draft', 'pending', 'deleted']
         )
开发者ID:NatEvatt,项目名称:geokey,代码行数:8,代码来源:test_manager.py

示例10: test_for_moderator

 def test_for_moderator(self):
     observations = Observation.objects.all().for_moderator(UserF.create())
     self.assertEqual(len(observations), 10)
     for observation in observations:
         self.assertNotIn(
             observation.status,
             ['draft', 'deleted']
         )
开发者ID:NatEvatt,项目名称:geokey,代码行数:8,代码来源:test_manager.py

示例11: setUp

 def setUp(self):
     self.user = UserF.create()
     self.app = ApplicationFactory.create()
     self.token = AccessToken.objects.create(
         user=self.user,
         client=self.app.client,
         token='df0af6a395b4cd072445b3832e9379bfee257da0',
         scope=1
     )
开发者ID:IdahoInstitute,项目名称:geokey,代码行数:9,代码来源:test_views.py

示例12: setUp

 def setUp(self):
     self.creator = UserF.create()
     ObservationFactory.create_batch(
         5, **{'status': 'active', 'creator': self.creator})
     ObservationFactory.create_batch(
         5, **{'status': 'draft', 'creator': self.creator})
     ObservationFactory.create_batch(
         5, **{'status': 'pending', 'creator': self.creator})
     ObservationFactory.create_batch(
         5, **{'status': 'deleted', 'creator': self.creator})
开发者ID:NatEvatt,项目名称:geokey,代码行数:10,代码来源:test_manager.py

示例13: test_delete_image_with_viewer

 def test_delete_image_with_viewer(self):
     viewer = UserF.create()
     dataview = GroupingFactory.create(
         add_viewers=[viewer],
         **{'project': self.project}
     )
     RuleFactory.create(**{
         'grouping': dataview,
         'category': self.contribution.category
     })
     response = self.delete(viewer)
     self.assertEqual(response.status_code, 404)
开发者ID:IdahoInstitute,项目名称:geokey,代码行数:12,代码来源:test_views.py


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