當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。