當前位置: 首頁>>代碼示例>>Python>>正文


Python observations.SingleContributionAPIView類代碼示例

本文整理匯總了Python中geokey.contributions.views.observations.SingleContributionAPIView的典型用法代碼示例。如果您正苦於以下問題:Python SingleContributionAPIView類的具體用法?Python SingleContributionAPIView怎麽用?Python SingleContributionAPIView使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了SingleContributionAPIView類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_update_user

    def test_update_user(self):
        url = reverse('api:project_single_observation', kwargs={
            'project_id': self.project.id,
            'observation_id': self.observation.id
        })
        request = self.factory.patch(url)
        request.data = {'properies': {'text': 'blah'}}
        request.user = self.viewer

        view = SingleContributionAPIView()
        view.update_and_respond(request, self.observation)
開發者ID:oliverroick,項目名稱:geokey,代碼行數:11,代碼來源:test_views.py

示例2: test_flag_with_moderator

    def test_flag_with_moderator(self):
        url = reverse('api:project_single_observation', kwargs={
            'project_id': self.project.id,
            'observation_id': self.observation.id
        })
        request = self.factory.patch(url)
        request.data = {'meta': {'status': "pending"}}
        request.user = self.moderator

        view = SingleContributionAPIView()
        view.update_and_respond(request, self.observation)
        ref = Observation.objects.get(pk=self.observation.id)
        self.assertEqual(ref.status, 'pending')
開發者ID:oliverroick,項目名稱:geokey,代碼行數:13,代碼來源:test_views.py

示例3: test_flag_with_anonymous

    def test_flag_with_anonymous(self):
        url = reverse('api:project_single_observation', kwargs={
            'project_id': self.project.id,
            'observation_id': self.observation.id
        })
        request = self.factory.patch(url)
        request.DATA = {'meta': {'status': "pending"}}
        request.user = AnonymousUser()

        view = SingleContributionAPIView()
        view.update_and_respond(request, self.observation)
        self.assertEqual(
            Observation.objects.get(pk=self.observation.id).status,
            'active'
        )
開發者ID:nagyistoce,項目名稱:geokey,代碼行數:15,代碼來源:test_views.py

示例4: test_suspend_pending_with_admin

    def test_suspend_pending_with_admin(self):
        self.observation.status = 'active'
        self.observation.save()

        url = reverse('api:project_single_observation', kwargs={
            'project_id': self.project.id,
            'observation_id': self.observation.id
        })
        request = self.factory.patch(url)
        request.data = {'meta': {'status': "pending"}}
        request.user = self.admin

        view = SingleContributionAPIView()
        view.update_and_respond(request, self.observation)
        self.assertEqual(
            Observation.objects.get(pk=self.observation.id).status,
            'pending'
        )
開發者ID:oliverroick,項目名稱:geokey,代碼行數:18,代碼來源:test_views.py

示例5: test_commit_from_draft_with_contributor_who_is_moderator

    def test_commit_from_draft_with_contributor_who_is_moderator(self):
        self.observation.status = 'draft'
        self.observation.save()

        url = reverse('api:project_single_observation', kwargs={
            'project_id': self.project.id,
            'observation_id': self.observation.id
        })
        request = self.factory.patch(url)
        request.data = {'meta': {'status': "active"}}
        request.user = self.creator

        view = SingleContributionAPIView()
        view.update_and_respond(request, self.observation)
        self.assertEqual(
            Observation.objects.get(pk=self.observation.id).status,
            'pending'
        )
開發者ID:oliverroick,項目名稱:geokey,代碼行數:18,代碼來源:test_views.py

示例6: test_update_under_review

    def test_update_under_review(self):
        CommentFactory.create(**{
            'commentto': self.observation,
            'review_status': 'open'
        })
        url = reverse('api:project_single_observation', kwargs={
            'project_id': self.project.id,
            'observation_id': self.observation.id
        })
        request = self.factory.patch(url)
        request.data = {'meta': {'status': 'active'}}
        request.user = self.admin

        view = SingleContributionAPIView()
        view.update_and_respond(request, self.observation)

        ref = Observation.objects.get(pk=self.observation.id)
        self.assertEqual(ref.status, 'review')
開發者ID:oliverroick,項目名稱:geokey,代碼行數:18,代碼來源:test_views.py

示例7: test_flag_with_anonymous

    def test_flag_with_anonymous(self):
        if not User.objects.filter(display_name='AnonymousUser').exists():
            UserF.create(display_name='AnonymousUser')

        url = reverse('api:project_single_observation', kwargs={
            'project_id': self.project.id,
            'observation_id': self.observation.id
        })
        request = self.factory.patch(url)
        request.data = {'meta': {'status': "pending"}}
        request.user = AnonymousUser()

        view = SingleContributionAPIView()
        view.update_and_respond(request, self.observation)
        self.assertEqual(
            Observation.objects.get(pk=self.observation.id).status,
            'active'
        )
開發者ID:oliverroick,項目名稱:geokey,代碼行數:18,代碼來源:test_views.py

示例8: test_approve_pending_with_admin_empty_properties

    def test_approve_pending_with_admin_empty_properties(self):
        self.observation.properties = None
        self.observation.status = 'pending'
        self.observation.save()

        url = reverse('api:project_single_observation', kwargs={
            'project_id': self.project.id,
            'observation_id': self.observation.id
        })
        request = self.factory.patch(url)
        request.DATA = {'meta': {'status': "active"}}
        request.user = self.admin

        view = SingleContributionAPIView()
        view.update_and_respond(request, self.observation)
        self.assertEqual(
            Observation.objects.get(pk=self.observation.id).status,
            'active'
        )
開發者ID:nagyistoce,項目名稱:geokey,代碼行數:19,代碼來源:test_views.py

示例9: test_commit_from_draft_with_contributor_with_data

    def test_commit_from_draft_with_contributor_with_data(self):
        self.observation.status = 'draft'
        self.observation.save()

        url = reverse('api:project_single_observation', kwargs={
            'project_id': self.project.id,
            'observation_id': self.observation.id
        })
        request = self.factory.patch(url)
        request.DATA = {
            'properties': {
                'key': 'updated'
            },
            'meta': {
                'status': "active",
            }
        }
        request.user = self.creator

        view = SingleContributionAPIView()
        view.update_and_respond(request, self.observation)
        ref = Observation.objects.get(pk=self.observation.id)
        self.assertEqual(ref.status, 'pending')
        self.assertEqual(ref.properties.get('key'), 'updated')
開發者ID:nagyistoce,項目名稱:geokey,代碼行數:24,代碼來源:test_views.py


注:本文中的geokey.contributions.views.observations.SingleContributionAPIView類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。