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


Python zone_client.ZoneClient类代码示例

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


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

示例1: test_import_domain

    def test_import_domain(self):
        user = 'default'
        resp, zone = ZoneClient.as_user(user).post_zone(
            datagen.random_zone_data())
        ZoneClient.as_user(user).wait_for_zone(zone.id)

        export_client = ZoneExportClient.as_user(user)

        resp, model = export_client.post_zone_export(zone.id)

        export_id = model.id
        self.assertEqual(resp.status, 202)
        self.assertEqual(model.status, 'PENDING')
        export_client.wait_for_zone_export(export_id)

        resp, model = export_client.get_zone_export(export_id)
        self.assertEqual(resp.status, 200)
        self.assertEqual(model.status, 'COMPLETE')

        resp, body = export_client.get_exported_zone(export_id)
        self.assertEqual(resp.status, 200)

        export_client.delete_zone_export(export_id)
        self.assertRaises(NotFound,
            lambda: export_client.get_zone_export(model.id))
开发者ID:ionrock,项目名称:designate,代码行数:25,代码来源:test_zone.py

示例2: setUp

 def setUp(self):
     super(RecordsetTest, self).setUp()
     self.increase_quotas(user='default')
     resp, self.zone = ZoneClient.as_user('default').post_zone(
         datagen.random_zone_data())
     ZoneClient.as_user('default').wait_for_zone(self.zone.id)
     self.client = RecordsetClient.as_user('default', with_token=False)
开发者ID:ramsateesh,项目名称:designate,代码行数:7,代码来源:test_recordset_unauthed.py

示例3: setUp

 def setUp(self):
     super(TransferZoneOwnerShipTest, self).setUp()
     self.increase_quotas(user='default')
     self.increase_quotas(user='alt')
     resp, self.zone = ZoneClient.as_user('default').post_zone(
         datagen.random_zone_data())
     ZoneClient.as_user('default').wait_for_zone(self.zone.id)
开发者ID:sonu999014,项目名称:designate,代码行数:7,代码来源:test_zone_ownership_transfers.py

示例4: test_do_zone_transfer_scoped

    def test_do_zone_transfer_scoped(self):
        target_project_id = TransferRequestClient.as_user('alt').tenant_id
        post_model = datagen.random_transfer_request_data(
            target_project_id=target_project_id)
        fixture = self.useFixture(TransferRequestFixture(
            zone=self.zone,
            post_model=post_model,
            user='default',
            target_user='alt',
        ))
        transfer_request = fixture.transfer_request

        resp, retrived_transfer_request = TransferRequestClient.\
            as_user('alt').get_transfer_request(transfer_request.id)

        self.assertEqual(200, resp.status)

        resp, transfer_accept = TransferAcceptClient.as_user('alt')\
            .post_transfer_accept(
                datagen.random_transfer_accept_data(
                    key=transfer_request.key,
                    zone_transfer_request_id=transfer_request.id
                ))
        self.assertEqual(201, resp.status)

        client = ZoneClient.as_user('default')

        self._assert_exception(
            exceptions.NotFound, 'domain_not_found', 404,
            client.get_zone, self.zone.id)

        resp, zone = ZoneClient.as_user('alt').get_zone(self.zone.id)

        self.assertEqual(200, resp.status)
开发者ID:zouyapeng,项目名称:designate,代码行数:34,代码来源:test_zone_ownership_transfers.py

示例5: test_do_zone_transfer_scoped

    def test_do_zone_transfer_scoped(self):

        target_project_id = TransferRequestClient.as_user('alt').tenant_id

        resp, transfer_request = TransferRequestClient.as_user('default')\
            .post_transfer_request(self.zone.id,
                                   datagen.random_transfer_request_data(
                                       target_project_id=target_project_id))

        self.assertEqual(resp.status, 201)

        resp, retrived_transfer_request = TransferRequestClient.\
            as_user('alt').get_transfer_request(transfer_request.id)

        self.assertEqual(resp.status, 200)

        resp, transfer_accept = TransferAcceptClient.as_user('alt')\
            .post_transfer_accept(
                datagen.random_transfer_accept_data(
                    key=transfer_request.key,
                    zone_transfer_request_id=transfer_request.id
                ))
        self.assertEqual(resp.status, 201)

        client = ZoneClient.as_user('default')

        self._assert_exception(
            exceptions.NotFound, 'domain_not_found', 404,
            client.get_zone, self.zone.id)

        resp, zone = ZoneClient.as_user('alt').get_zone(self.zone.id)

        self.assertEqual(resp.status, 200)
开发者ID:sonu999014,项目名称:designate,代码行数:33,代码来源:test_zone_ownership_transfers.py

示例6: setUp

 def setUp(self):
     super(ZoneTest, self).setUp()
     self.increase_quotas(user='default')
     self.authed_client = ZoneClient.as_user('default')
     self.client = ZoneClient.as_user('default', with_token=False)
     self.fixture = self.useFixture(ZoneFixture(user='default'))
     self.zone = None
开发者ID:cneill,项目名称:designate-testing,代码行数:7,代码来源:test_zone_unauthed.py

示例7: test_no_create_subdomain_by_alt_user

 def test_no_create_subdomain_by_alt_user(self):
     zone = self.useFixture(ZoneFixture(user='default')).post_model
     subzone = datagen.random_zone_data(name='sub.' + zone.name)
     subsubzone = datagen.random_zone_data(name='sub.sub.' + zone.name)
     self.assertRaises(Forbidden,
         lambda: ZoneClient.as_user('alt').post_zone(subzone))
     self.assertRaises(Forbidden,
         lambda: ZoneClient.as_user('alt').post_zone(subsubzone))
开发者ID:BeenzSyed,项目名称:designate,代码行数:8,代码来源:test_zone.py

示例8: _create_transfer_request

 def _create_transfer_request(self):
     client = TransferRequestClient.as_user(self.user)
     self.post_resp, self.transfer_request = client \
         .post_transfer_request(self.zone.id, self.post_model)
     assert self.post_resp.status == 201
     self.addCleanup(self.cleanup_transfer_request, client,
                     self.transfer_request.id)
     self.addCleanup(ZoneFixture.cleanup_zone,
                     ZoneClient.as_user(self.user), self.zone.id)
     self.addCleanup(ZoneFixture.cleanup_zone,
                     ZoneClient.as_user(self.target_user), self.zone.id)
开发者ID:ISCAS-VDI,项目名称:designate-base,代码行数:11,代码来源:fixtures.py

示例9: test_no_create_recordset_via_alt_domain

    def test_no_create_recordset_via_alt_domain(self):
        resp, zone = ZoneClient.as_user("default").post_zone(datagen.random_zone_data())
        resp, alt_zone = ZoneClient.as_user("alt").post_zone(datagen.random_zone_data())

        # alt attempts to create record with name A12345.{zone}
        recordset = datagen.random_a_recordset(zone_name=zone.name)
        self.assertRaises(
            RestClientException, lambda: RecordsetClient.as_user("alt").post_recordset(zone.id, recordset)
        )
        self.assertRaises(
            RestClientException, lambda: RecordsetClient.as_user("alt").post_recordset(alt_zone.id, recordset)
        )
开发者ID:cneill,项目名称:designate,代码行数:12,代码来源:test_recordset.py

示例10: test_update_zone

    def test_update_zone(self):
        old_model = self.fixture.created_zone

        patch_model = datagen.random_zone_data()
        del patch_model.name  # don't try to override the zone name
        resp, new_model = ZoneClient.as_user("default").patch_zone(old_model.id, patch_model)
        self.assertEqual(resp.status, 202)
        ZoneClient.as_user("default").wait_for_zone(new_model.id)

        resp, model = ZoneClient.as_user("default").get_zone(new_model.id)
        self.assertEqual(resp.status, 200)
        self.assertEqual(new_model.id, old_model.id)
        self.assertEqual(new_model.name, old_model.name)
        self.assertEqual(new_model.ttl, patch_model.ttl)
        self.assertEqual(new_model.email, patch_model.email)
开发者ID:ramsateesh,项目名称:designate,代码行数:15,代码来源:test_zone.py

示例11: setUp

 def setUp(self):
     super(RecordsetFuzzTest, self).setUp()
     # self.increase_quotas(user='admin')
     resp, self.zone = ZoneClient.as_user('default').post_zone(
         datagen.random_zone_data())
     # ZoneClient.as_user('default').wait_for_zone(self.zone.id)
     self.client = RecordsetClient.as_user('default')
开发者ID:cneill,项目名称:designate-testing,代码行数:7,代码来源:test_recordset_security.py

示例12: test_no_create_super_recordsets

    def test_no_create_super_recordsets(self):
        # default creates zone a.b.c.example.com.
        # alt fails to create record with name b.c.example.com
        zone_data = datagen.random_zone_data()
        recordset = datagen.random_a_recordset(zone_name=zone_data.name)
        recordset.name = 'b.c.' + zone_data.name
        zone_data.name = 'a.b.c.' + zone_data.name

        resp, zone = ZoneClient.as_user('default').post_zone(zone_data)
        self.assertRaises(exceptions.RestClientException,
            lambda: RecordsetClient.as_user('alt')
                    .post_recordset(zone.id, recordset))
开发者ID:ionrock,项目名称:designate,代码行数:12,代码来源:test_recordset.py

示例13: test_no_create_recordset_by_alt_tenant

    def test_no_create_recordset_by_alt_tenant(self):
        resp, zone = ZoneClient.as_user("default").post_zone(datagen.random_zone_data())

        # try with name=A123456.zone.com.
        recordset = datagen.random_a_recordset(zone_name=zone.name)
        self.assertRaises(
            RestClientException, lambda: RecordsetClient.as_user("alt").post_recordset(zone.id, recordset)
        )

        # try with name=zone.com.
        recordset.name = zone.name
        self.assertRaises(
            RestClientException, lambda: RecordsetClient.as_user("alt").post_recordset(zone.id, recordset)
        )
开发者ID:cneill,项目名称:designate,代码行数:14,代码来源:test_recordset.py

示例14: test_import_domain

    def test_import_domain(self):
        user = "default"
        import_client = ZoneImportClient.as_user(user)
        zone_client = ZoneClient.as_user(user)

        fixture = self.useFixture(ZoneImportFixture(user=user))
        import_id = fixture.zone_import.id

        resp, model = import_client.get_zone_import(import_id)
        self.assertEqual(resp.status, 200)
        self.assertEqual(model.status, "COMPLETE")
        self.addCleanup(ZoneFixture.cleanup_zone, zone_client, model.zone_id)

        # Wait for the zone to become 'ACTIVE'
        zone_client.wait_for_zone(model.zone_id)
        resp, zone_model = zone_client.get_zone(model.zone_id)

        # Now make sure we can delete the zone_import
        import_client.delete_zone_import(import_id)
        self.assertRaises(NotFound, lambda: import_client.get_zone_import(model.id))
开发者ID:ramsateesh,项目名称:designate,代码行数:20,代码来源:test_zone.py

示例15: test_list_zones

 def test_list_zones(self):
     resp, model = ZoneClient.as_user('default').list_zones()
     self.assertEqual(200, resp.status)
     self.assertGreater(len(model.zones), 0)
开发者ID:BeenzSyed,项目名称:designate,代码行数:4,代码来源:test_zone.py


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