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


Python factories.GroupFactory類代碼示例

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


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

示例1: setUp

    def setUp(self):
        self.anonymous_user = AnonymousUserFactory()
        self.user = UserFactory.create()
        self.group = GroupFactory.create(name=self.user.username)
        self.project = ProjectFactory.create(owner=self.group)

        self.not_user = UserFactory.create()
        self.not_group = GroupFactory.create(name=self.not_user.username)

        self.view = ProjectViewSet.as_view({"delete": "destroy"})
        self.factory = APIRequestFactory()
        self.url = reverse("api:v2:project-detail", args=(self.project.id,))
        self.request = self.factory.delete(self.url)
開發者ID:Cyberlusion,項目名稱:Restoring-the-ecosystem,代碼行數:13,代碼來源:test_projects.py

示例2: setUp

    def setUp(self):
        self.anonymous_user = AnonymousUserFactory()
        self.user = UserFactory.create()
        self.group = GroupFactory.create(name=self.user.username)
        self.project = ProjectFactory.create(owner=self.group)

        user2 = UserFactory.create()
        group2 = GroupFactory.create(name=user2.username)
        ProjectFactory.create(owner=group2)

        self.view = ProjectViewSet.as_view({'get': 'retrieve'})
        factory = APIRequestFactory()
        url = reverse('api:v2:project-detail', args=(self.project.id,))
        self.request = factory.get(url)
開發者ID:miquelcie,項目名稱:atmosphere,代碼行數:14,代碼來源:test_projects.py

示例3: setUp

    def setUp(self):
        self.view = ViewSet.as_view({'get': 'retrieve'})
        self.anonymous_user = AnonymousUserFactory()
        self.user = UserFactory.create()
        self.group = GroupFactory.create(name=self.user.username)
        self.leadership = LeadershipFactory.create(
            user=self.user,
            group=self.group
            )
        self.staff_user = UserFactory.create(is_staff=True)

        self.provider = ProviderFactory.create()
        self.identity = IdentityFactory.create(
            provider=self.provider,
            created_by=self.user)
        self.quota = QuotaFactory.create()
        self.allocation = AllocationFactory.create()
        IdentityMembershipFactory.create(
            member=self.group,
            identity=self.identity,
            quota=self.quota
        )

        factory = APIRequestFactory()
        url = reverse('api:v2:identity-detail', args=(self.identity.id,))
        self.request = factory.get(url)
        force_authenticate(self.request, user=self.user)
        self.response = self.view(self.request, pk=self.identity.id)
開發者ID:Cyberlusion,項目名稱:Restoring-the-ecosystem,代碼行數:28,代碼來源:test_identities.py

示例4: setUp

    def setUp(self):
        self.list_view = ViewSet.as_view({'get': 'list'})
        self.detailed_view = ViewSet.as_view({'get': 'retrieve'})
        self.anonymous_user = AnonymousUserFactory()
        self.user = UserFactory.create()
        self.group = GroupFactory.create(name=self.user.username)
        self.staff_user = UserFactory.create(is_staff=True)

        self.provider = ProviderFactory.create()
        self.quota = QuotaFactory.create()
        self.identity = IdentityFactory.create(
            provider=self.provider, quota=self.quota, created_by=self.user
        )
        IdentityMembershipFactory.create(
            member=self.group,
            identity=self.identity,
        )

        factory = APIRequestFactory()
        detail_url = reverse(
            'api:v2:identity-detail', args=(self.identity.id, )
        )
        self.detail_request = factory.get(detail_url)

        list_url = reverse('api:v2:identity-list')
        self.list_request = factory.get(list_url)
開發者ID:iPlantCollaborativeOpenSource,項目名稱:atmosphere,代碼行數:26,代碼來源:test_identities.py

示例5: setUp

 def setUp(self):
     self.anonymous_user = AnonymousUserFactory()
     self.user = UserFactory.create()
     self.group = GroupFactory.create(name=self.user.username)
     self.group.user_set.add(self.user)
     self.provider = ProviderFactory.create(location="mock location", type__name="mock")
     self.view = TokenUpdateViewSet.as_view({'post': 'create'})
     self.identity_view = IdentityViewSet.as_view({'get': 'retrieve'})
     self.credentials_view = CredentialViewSet.as_view({'get': 'list'})
     self.token_uuid = "test-token-1234-debug"
開發者ID:xuhang57,項目名稱:atmosphere,代碼行數:10,代碼來源:test_token_update.py

示例6: setUp

    def setUp(self):
        self.view = ViewSet.as_view({'get': 'retrieve'})
        self.anonymous_user = AnonymousUserFactory()
        self.user = UserFactory.create()
        self.group = GroupFactory.create(name=self.user.username)
        self.staff_user = UserFactory.create(is_staff=True)

        self.quota = QuotaFactory.create()

        factory = APIRequestFactory()
        url = reverse('api:v2:quota-detail', args=(self.quota.id,))
        self.request = factory.get(url)
        force_authenticate(self.request, user=self.user)
        self.response = self.view(self.request, pk=self.quota.id)
開發者ID:EthanChen-Field,項目名稱:atmosphere,代碼行數:14,代碼來源:test_quotas.py

示例7: setUp

    def setUp(self):
        self.view = ViewSet.as_view({'get': 'list'})
        self.anonymous_user = AnonymousUserFactory()
        self.user = UserFactory.create()
        self.group = GroupFactory.create(name=self.user.username)
        self.staff_user = UserFactory.create(is_staff=True)

        self.provider_type = ProviderTypeFactory.create()

        factory = APIRequestFactory()
        url = reverse('api:v2:providertype-list')
        self.request = factory.get(url)
        force_authenticate(self.request, user=self.user)
        self.response = self.view(self.request)
開發者ID:Angelfirenze,項目名稱:atmosphere,代碼行數:14,代碼來源:test_provider_types.py

示例8: setUp

    def setUp(self):
        self.anonymous_user = AnonymousUserFactory()
        self.user = UserFactory.create()
        self.group = GroupFactory.create(name=self.user.username)
        self.staff_user = UserFactory.create(is_staff=True)

        self.platform_type = PlatformTypeFactory.create()

        factory = APIRequestFactory()

        self.detail_view = ViewSet.as_view({'get': 'retrieve'})
        detail_url = reverse(
            self.url_route+'-detail', args=(self.platform_type.id,))
        self.detail_request = factory.get(detail_url)

        self.list_view = ViewSet.as_view({'get': 'list'})
        list_url = reverse(
            self.url_route+'-list')
        self.list_request = factory.get(list_url)
開發者ID:xuhang57,項目名稱:atmosphere,代碼行數:19,代碼來源:test_platform_types.py

示例9: setUp

    def setUp(self):
        self.anonymous_user = AnonymousUserFactory()

        self.user = UserFactory.create()
        self.group = GroupFactory.create(name=self.user.username)
        self.membership = GroupMembershipFactory.create(
            user=self.user, group=self.group, is_leader=True
        )
        self.group.user_set.add(self.user)
        self.project = ProjectFactory.create(
            owner=self.group, created_by=self.user
        )
        self.enddated_instance = InstanceFactory.create(
            created_by=self.user, end_date=timezone.now(), project=self.project
        )

        self.user2 = UserFactory.create()
        self.group2 = GroupFactory.create(name=self.user2.username)
        self.membership2 = GroupMembershipFactory.create(
            user=self.user2, group=self.group2, is_leader=True
        )
        self.group2.user_set.add(self.user2)
        self.project2 = ProjectFactory.create(
            owner=self.group2, created_by=self.user2
        )

        self.not_user = UserFactory.create()
        self.not_group = GroupFactory.create(name=self.not_user.username)
        self.not_membership = GroupMembershipFactory.create(
            user=self.not_user, group=self.not_group, is_leader=True
        )
        self.not_group.user_set.add(self.not_user)
        self.not_project = ProjectFactory.create(
            owner=self.not_group, created_by=self.not_user
        )

        self.unsaved_project = ProjectFactory.build(
            owner=self.group, created_by=self.user
        )

        list_url = reverse('api:v2:project-list')
        detail_url = reverse('api:v2:project-detail', args=(self.project.id, ))

        self.create_view = ProjectViewSet.as_view({'post': 'create'})
        self.delete_view = ProjectViewSet.as_view({'delete': 'destroy'})
        self.detail_view = ProjectViewSet.as_view({'get': 'retrieve'})
        self.list_view = ProjectViewSet.as_view({'get': 'list'})
        self.update_view = ProjectViewSet.as_view({'patch': 'partial_update'})

        self.factory = APIRequestFactory()
        self.bad_create_request = self.factory.post(list_url)
        self.create_request = self.factory.post(
            list_url, {
                'name': self.unsaved_project.name,
                'description': self.unsaved_project.description,
                'owner': self.group.name
            }
        )
        self.delete_request = self.factory.delete(detail_url)
        self.detail_request = self.factory.get(detail_url)
        self.list_request = self.factory.get(list_url)
        self.updated_project_data = {
            'name': 'updated name',
            'description': 'updated description'
        }
        self.update_request = self.factory.patch(
            detail_url, self.updated_project_data
        )
開發者ID:iPlantCollaborativeOpenSource,項目名稱:atmosphere,代碼行數:68,代碼來源:test_projects.py


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