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


Python recordset_client.RecordsetClient类代码示例

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


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

示例1: test_crud_recordset

    def test_crud_recordset(self, make_recordset):
        post_model = make_recordset(self.zone)
        resp, post_resp_model = RecordsetClient.as_user("default").post_recordset(self.zone.id, post_model)
        self.assertEqual(resp.status, 202, "on post response")
        self.assertEqual(post_resp_model.status, "PENDING")
        self.assertEqual(post_resp_model.name, post_model.name)
        self.assertEqual(post_resp_model.records, post_model.records)
        self.assertEqual(post_resp_model.ttl, post_model.ttl)

        recordset_id = post_resp_model.id
        RecordsetClient.as_user("default").wait_for_recordset(self.zone.id, recordset_id)

        put_model = make_recordset(self.zone)
        del put_model.name  # don't try to update the name
        resp, put_resp_model = RecordsetClient.as_user("default").put_recordset(self.zone.id, recordset_id, put_model)
        self.assertEqual(resp.status, 202, "on put response")
        self.assertEqual(put_resp_model.status, "PENDING")
        self.assertEqual(put_resp_model.name, post_model.name)
        self.assertEqual(put_resp_model.records, put_model.records)
        self.assertEqual(put_resp_model.ttl, put_model.ttl)

        RecordsetClient.as_user("default").wait_for_recordset(self.zone.id, recordset_id)

        resp, delete_resp_model = RecordsetClient.as_user("default").delete_recordset(self.zone.id, recordset_id)
        self.assertEqual(resp.status, 202, "on delete response")
        RecordsetClient.as_user("default").wait_for_404(self.zone.id, recordset_id)
开发者ID:cneill,项目名称:designate,代码行数:26,代码来源:test_recordset.py

示例2: test_no_create_recordset_via_alt_domain

    def test_no_create_recordset_via_alt_domain(self):
        zone = self.useFixture(ZoneFixture(user='default')).created_zone
        alt_zone = self.useFixture(ZoneFixture(user='alt')).created_zone

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

示例3: 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

示例4: test_get_single_recordset

    def test_get_single_recordset(self):
        post_model = datagen.random_a_recordset(self.zone.name)
        _, resp_model = RecordsetClient.as_user('default').post_recordset(
                self.zone.id, post_model)
        rrset_id = resp_model.id

        resp, model = RecordsetClient.as_user('default').get_recordset(
                self.zone.id, rrset_id, cross_zone=True)
        self.assertEqual(200, resp.status)

        # clean up
        RecordsetClient.as_user('default').delete_recordset(self.zone.id,
                                                            rrset_id)
开发者ID:nivazri,项目名称:designate,代码行数:13,代码来源:test_recordset.py

示例5: 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

示例6: test_no_create_recordset_by_alt_tenant

    def test_no_create_recordset_by_alt_tenant(self):
        zone = self.useFixture(ZoneFixture(user='default')).created_zone

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

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

示例7: _create_recordset

    def _create_recordset(self):
        client = RecordsetClient.as_user(self.user)
        self.post_resp, self.created_recordset = client.post_recordset(
            self.zone_id, self.post_model)
        assert self.post_resp.status == 202
        self.addCleanup(self.cleanup_recordset, client, self.zone_id,
                        self.created_recordset.id)

        assert self.created_recordset.status == "PENDING"
        assert self.created_recordset.name == self.post_model.name
        assert self.created_recordset.ttl == self.post_model.ttl
        assert self.created_recordset.records == self.post_model.records

        RecordsetClient.as_user('default').wait_for_recordset(
            self.zone_id, self.created_recordset.id)
开发者ID:ISCAS-VDI,项目名称:designate-base,代码行数:15,代码来源:fixtures.py

示例8: test_delete_existing_recordset

 def test_delete_existing_recordset(self):
     post_model = datagen.random_a_recordset(self.zone.name)
     resp, resp_model = RecordsetClient.as_user('default') \
         .post_recordset(self.zone.id, post_model)
     self.assertRaises(
         exceptions.Unauthorized, self.client.delete_recordset,
         self.zone.id, resp_model.id)
开发者ID:ISCAS-VDI,项目名称:designate-base,代码行数:7,代码来源:test_recordset_unauthed.py

示例9: test_export_domain

    def test_export_domain(self):
        user = 'default'
        zone_fixture = self.useFixture(ZoneFixture(user=user))
        zone = zone_fixture.created_zone

        export_fixture = self.useFixture(ZoneExportFixture(zone.id, user=user))
        export_id = export_fixture.zone_export.id

        export_client = ZoneExportClient.as_user(user)

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

        # fetch the zone file
        resp, zone_file = export_client.get_exported_zone(export_id)
        self.assertEqual(200, resp.status)
        self.assertEqual(zone.name, zone_file.origin)
        self.assertEqual(zone.ttl, zone_file.ttl)

        # the list of records in the zone file must match the zone's recordsets
        # (in this case there should be only two records - a SOA and an NS?)
        recordset_client = RecordsetClient.as_user(user)
        resp, model = recordset_client.list_recordsets(zone.id)
        records = []
        for recordset in model.recordsets:
            records.extend(ZoneFileRecord.records_from_recordset(recordset))
        self.assertEqual(set(records), set(zone_file.records))

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

示例10: 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

示例11: test_list_recordsets

 def test_list_recordsets(self):
     post_model = datagen.random_a_recordset(self.zone.name)
     self.useFixture(RecordsetFixture(self.zone.id, post_model))
     resp, model = RecordsetClient.as_user('default') \
         .list_recordsets(self.zone.id)
     self.assertEqual(200, resp.status)
     self.assertGreater(len(model.recordsets), 0)
开发者ID:TimSimmons,项目名称:designate,代码行数:7,代码来源:test_recordset.py

示例12: 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

示例13: test_cname_recordsets_cannot_have_more_than_one_record

    def test_cname_recordsets_cannot_have_more_than_one_record(self):
        post_model = datagen.random_cname_recordset(zone_name=self.zone.name)
        post_model.records = [
            "a.{0}".format(self.zone.name),
            "b.{0}".format(self.zone.name),
        ]

        client = RecordsetClient.as_user('default')
        self.assertRaises(exceptions.BadRequest,
            client.post_recordset, self.zone.id, post_model)
开发者ID:TimSimmons,项目名称:designate,代码行数:10,代码来源:test_recordset.py

示例14: test_create_invalid

    def test_create_invalid(self, make_recordset, data=None):
        data = data or ["b0rk"]

        client = RecordsetClient.as_user('default')

        for i in data:
            model = make_recordset(self.zone)
            model.data = i
            self._assert_exception(
                exceptions.BadRequest, 'invalid_object', 400,
                client.post_recordset, self.zone.id, model)
开发者ID:ionrock,项目名称:designate,代码行数:11,代码来源:test_recordset.py

示例15: 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


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