summaryrefslogtreecommitdiff
path: root/designateclient/tests/test_v1
diff options
context:
space:
mode:
Diffstat (limited to 'designateclient/tests/test_v1')
-rw-r--r--designateclient/tests/test_v1/__init__.py53
-rw-r--r--designateclient/tests/test_v1/test_client.py124
-rw-r--r--designateclient/tests/test_v1/test_diagnostics.py30
-rw-r--r--designateclient/tests/test_v1/test_domain.py184
-rw-r--r--designateclient/tests/test_v1/test_quotas.py48
-rw-r--r--designateclient/tests/test_v1/test_records.py222
-rw-r--r--designateclient/tests/test_v1/test_reports.py54
-rw-r--r--designateclient/tests/test_v1/test_servers.py95
-rw-r--r--designateclient/tests/test_v1/test_sync.py42
-rw-r--r--designateclient/tests/test_v1/test_touch.py29
10 files changed, 0 insertions, 881 deletions
diff --git a/designateclient/tests/test_v1/__init__.py b/designateclient/tests/test_v1/__init__.py
deleted file mode 100644
index 3654a91..0000000
--- a/designateclient/tests/test_v1/__init__.py
+++ /dev/null
@@ -1,53 +0,0 @@
-# Copyright 2015 Hewlett-Packard Development Company, L.P.
-#
-# Author: Kiall Mac Innes <kiall@hp.com>
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-import uuid
-
-from designateclient.tests import base
-
-
-class CrudMixin(object):
- path_prefix = None
-
- def new_ref(self, **kwargs):
- kwargs.setdefault('id', uuid.uuid4().hex)
- return kwargs
-
- def stub_entity(self, method, parts=None, entity=None, id=None, **kwargs):
- if entity:
- kwargs['json'] = entity
-
- if not parts:
- parts = [self.RESOURCE]
-
- if self.path_prefix:
- parts.insert(0, self.path_prefix)
-
- if id:
- if not parts:
- parts = []
-
- parts.append(id)
-
- self.stub_url(method, parts=parts, **kwargs)
-
- def assertList(self, expected, actual):
- self.assertEqual(len(expected), len(actual))
- for i in expected:
- self.assertIn(i, actual)
-
-
-class APIV1TestCase(base.APITestCase):
- VERSION = "1"
diff --git a/designateclient/tests/test_v1/test_client.py b/designateclient/tests/test_v1/test_client.py
deleted file mode 100644
index f46f64d..0000000
--- a/designateclient/tests/test_v1/test_client.py
+++ /dev/null
@@ -1,124 +0,0 @@
-# Copyright 2015 Hewlett-Packard Development Company, L.P.
-#
-# Author: Kiall Mac Innes <kiall@hp.com>
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-from designateclient.tests import test_v1
-from designateclient import utils
-from designateclient import v1
-
-from keystoneauth1 import session as keystone_session
-
-
-class TestClient(test_v1.APIV1TestCase):
- def test_all_tenants(self):
- # Create a client with the all_tenants flag set to True
- client = v1.Client(all_tenants=True)
-
- # Verify this has been picked up
- self.assertTrue(client.all_tenants)
-
- def test_all_tenants_not_supplied(self):
- # Create a client without supplying any all_tenants flag
- client = v1.Client()
-
- # Verify all_tenants is False
- self.assertFalse(client.all_tenants)
- self.assertIsNotNone(client.all_tenants)
-
- def test_all_tenants_through_session(self):
- # Create a session with the all_tenants flag set to True
- session = utils.get_session(
- auth_url='Anything',
- endpoint='Anything',
- domain_id='Anything',
- domain_name='Anything',
- project_id='Anything',
- project_name='Anything',
- project_domain_name='Anything',
- project_domain_id='Anything',
- username='Anything',
- user_id='Anything',
- password='Anything',
- user_domain_id='Anything',
- user_domain_name='Anything',
- token=None,
- insecure=False,
- cacert=None,
- all_tenants=True)
-
- # Create a client using the pre-created session
- client = v1.Client(session=session)
-
- # Verify the all_tenants flag has been picked up
- self.assertTrue(client.all_tenants)
-
- def test_edit_managed(self):
- # Create a client with the edit_managed flag set to True
- client = v1.Client(edit_managed=True)
-
- # Verify this has been picked up
- self.assertTrue(client.edit_managed)
-
- def test_edit_managed_not_supplied(self):
- # Create a client without supplying any edit_managed flag
- client = v1.Client()
-
- # Verify edit_managed is False
- self.assertFalse(client.edit_managed)
- self.assertIsNotNone(client.edit_managed)
-
- def test_edit_managed_through_session(self):
- # Create a session with the edit_managed flag set to True
- session = utils.get_session(
- auth_url='Anything',
- endpoint='Anything',
- domain_id='Anything',
- domain_name='Anything',
- project_id='Anything',
- project_name='Anything',
- project_domain_name='Anything',
- project_domain_id='Anything',
- username='Anything',
- user_id='Anything',
- password='Anything',
- user_domain_id='Anything',
- user_domain_name='Anything',
- token=None,
- insecure=False,
- cacert=None,
- edit_managed=True)
-
- # Create a client using the pre-created session
- client = v1.Client(session=session)
-
- # Verify the edit_managed flag has been picked up
- self.assertTrue(client.edit_managed)
-
- def test_timeout_new_session(self):
- client = v1.Client(
- auth_url="http://127.0.0.1:22/",
- timeout=1,
- )
- assert client.session.timeout == 1
-
- def test_timeout_override_session_timeout(self):
- # The adapter timeout should override the session timeout
- session = keystone_session.Session(timeout=10)
- client = v1.Client(
- auth_url="http://127.0.0.1:22/",
- session=session,
- timeout=2,
- )
- self.assertEqual(2, client.session.timeout)
diff --git a/designateclient/tests/test_v1/test_diagnostics.py b/designateclient/tests/test_v1/test_diagnostics.py
deleted file mode 100644
index 09487f1..0000000
--- a/designateclient/tests/test_v1/test_diagnostics.py
+++ /dev/null
@@ -1,30 +0,0 @@
-# Copyright 2015 NEC Corporation. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-import mock
-from mock import patch
-
-from designateclient.tests import test_v1
-from designateclient.v1 import diagnostics
-
-
-class TestDiagnostics(test_v1.APIV1TestCase, test_v1.CrudMixin):
-
- @patch.object(diagnostics.DiagnosticsController, "ping")
- def test_ping(self, ping):
- args = mock.MagicMock()
- args.service = "foo"
- args.host = "host1"
- self.client.diagnostics.ping(args.host, args.service)
- self.client.diagnostics.ping.assert_called_with("host1", "foo")
diff --git a/designateclient/tests/test_v1/test_domain.py b/designateclient/tests/test_v1/test_domain.py
deleted file mode 100644
index fa69030..0000000
--- a/designateclient/tests/test_v1/test_domain.py
+++ /dev/null
@@ -1,184 +0,0 @@
-# Copyright 2015 NEC Corporation. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-import uuid
-
-from mock import patch
-
-from designateclient.tests import test_v1
-from designateclient import utils
-from designateclient.v1 import domains
-from designateclient import warlock
-
-Domain = warlock.model_factory(utils.load_schema('v1', 'domain'))
-
-
-class TestDomain(test_v1.APIV1TestCase, test_v1.CrudMixin):
- RESOURCE = 'domains'
-
- def new_ref(self, **kwargs):
- ref = super(TestDomain, self).new_ref(**kwargs)
- ref.setdefault("name", uuid.uuid4().hex)
- ref.setdefault("email", "abc@example.com.")
- ref.setdefault("ttl", 3600)
- return ref
-
- def test_create(self):
- ref = {"id": "89acac79-38e7-497d-807c-a011e1310438",
- "name": "domain1.com.",
- "email": "nsadmin@example.org",
- "ttl": 60}
- self.stub_url("POST", parts=[self.RESOURCE], json=ref)
-
- values = ref.copy()
- del values["id"]
-
- response = self.client.domains.create(values["name"])
- self.assertEqual(ref['id'], response['id'])
-
- def test_create_with_description(self):
- ref = {"id": "89acac79-38e7-497d-807c-a011e1310438",
- "name": "domain1.com.",
- "email": "nsadmin@example.org",
- "ttl": 60,
- "description": "fully qualified domain"}
-
- self.stub_url("POST", parts=[self.RESOURCE], json=ref)
-
- values = ref.copy()
- del values["id"]
-
- response = self.client.domains.create(values["name"])
- self.assertEqual(ref['id'], response['id'])
-
- def test_create_with_description_too_long(self):
- ref = {"id": "89acac79-38e7-497d-807c-a011e1310438",
- "name": "domain1.com.",
- "email": "nsadmin@example.org",
- "ttl": 60,
- "description": "d" * 161}
- self.stub_url("POST", parts=[self.RESOURCE], json=ref)
-
- values = ref.copy()
- del values["id"]
-
- self.assertRaises(ValueError, self.client.domains.create,
- values["name"])
-
- def test_create_with_zero_ttl(self):
- ref = {"id": "89acac79-38e7-497d-807c-a011e1310438",
- "name": "domain1.com.",
- "email": "nsadmin@example.org",
- "ttl": 0}
- self.stub_url("POST", parts=[self.RESOURCE], json=ref)
-
- values = ref.copy()
- del values["id"]
-
- self.assertRaises(ValueError, self.client.domains.create,
- values["name"])
-
- def test_create_with_negative_ttl(self):
- ref = {"id": "89acac79-38e7-497d-807c-a011e1310438",
- "name": "domain1.com.",
- "email": "nsadmin@example.org",
- "ttl": -1}
- self.stub_url("POST", parts=[self.RESOURCE], json=ref)
-
- values = ref.copy()
- del values["id"]
-
- self.assertRaises(ValueError, self.client.domains.create,
- values["name"])
-
- def test_create_with_no_ttl(self):
- ref = {"id": "89acac79-38e7-497d-807c-a011e1310438",
- "name": "domain1.com.",
- "email": "nsadmin@example.org",
- "ttl": ""}
- self.stub_url("POST", parts=[self.RESOURCE], json=ref)
-
- values = ref.copy()
- del values["id"]
-
- self.assertRaises(ValueError, self.client.domains.create,
- values["name"])
-
- def test_create_with_name_too_long(self):
- ref = {"id": "89acac79-38e7-497d-807c-a011e1310438",
- "name": "domain" + "a" * 255 + ".com.",
- "email": "nsadmin@example.org",
- "ttl": 60}
- self.stub_url("POST", parts=[self.RESOURCE], json=ref)
-
- values = ref.copy()
- del values["id"]
-
- self.assertRaises(ValueError, self.client.domains.create,
- values["name"])
-
- def test_list(self):
- items = [
- self.new_ref(email="abc@example.org",
- id="89acac79-38e7-497d-807c-a011e1310438"),
- self.new_ref(email="root@example.org",
- id="89acac79-38e7-497d-807c-a011e1310435")
- ]
-
- self.stub_url("GET", parts=[self.RESOURCE], json={"domains": items})
-
- listed = self.client.domains.list()
- self.assertList(items, listed)
- self.assertQueryStringIs("")
-
- def test_get(self):
- ref = self.new_ref(email="abc@example.org",
- id="89acac79-38e7-497d-807c-a011e1310438")
-
- self.stub_entity("GET", entity=ref, id=ref["id"])
-
- response = self.client.domains.get(ref["id"])
- self.assertEqual(ref, response)
-
- def test_delete(self):
- ref = self.new_ref(email="abc@example.org",
- id="89acac79-38e7-497d-807c-a011e1310438")
-
- self.stub_entity("DELETE", entity=ref, id=ref["id"])
-
- self.client.domains.delete(ref["id"])
- self.assertRequestBodyIs(None)
-
- def test_update(self):
- ref = self.new_ref(id="89acac79-38e7-497d-807c-a011e1310438")
-
- self.stub_entity("PUT", entity=ref, id=ref["id"])
-
- values = ref.copy()
-
- self.client.domains.update(Domain(values))
-
- @patch.object(domains.DomainsController, "list_domain_servers")
- def test_list_domain_servers(self, domains_get):
- domains_get.return_value = [{"id": "foo", "name": "ns1.example.com."}]
-
- ref = [{
- "id": "foo",
- "name": "ns1.example.com.",
- }]
- parts = ["domains", "foo", "servers"]
- self.stub_url("GET", parts=parts, json={"servers": ref})
-
- response = self.client.domains.list_domain_servers("foo")
- self.assertEqual(ref, response)
diff --git a/designateclient/tests/test_v1/test_quotas.py b/designateclient/tests/test_v1/test_quotas.py
deleted file mode 100644
index 4e73940..0000000
--- a/designateclient/tests/test_v1/test_quotas.py
+++ /dev/null
@@ -1,48 +0,0 @@
-# Copyright 2015 NEC Corporation. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-import mock
-from mock import patch
-
-from designateclient.tests import test_v1
-from designateclient.v1 import quotas
-
-
-class TestQuota(test_v1.APIV1TestCase, test_v1.CrudMixin):
-
- @patch.object(quotas.QuotasController, "get")
- def test_get(self, quota_get):
- QUOTA = {"domains": 10,
- "recordset_records": 20,
- "domain_records": 500,
- "domain_recordsets": 500}
- quota_get.return_value = QUOTA
- response = self.client.quotas.get("foo")
- self.assertEqual(QUOTA, response)
-
- @patch.object(quotas.QuotasController, "update")
- def test_update(self, quota_update):
- args = mock.MagicMock()
- args.tenant_id = "1234"
- args.value = {"domains": 1000}
- self.client.quotas.update(args.tenant_id, args.value)
- self.client.quotas.update.assert_called_with(args.tenant_id,
- args.value)
-
- @patch.object(quotas.QuotasController, "reset")
- def test_reset(self, quota_reset):
- args = mock.MagicMock()
- args.tenant_id = "1234"
- self.client.quotas.reset(args.tenant_id)
- self.client.quotas.reset.assert_called_with("1234")
diff --git a/designateclient/tests/test_v1/test_records.py b/designateclient/tests/test_v1/test_records.py
deleted file mode 100644
index b1b54b5..0000000
--- a/designateclient/tests/test_v1/test_records.py
+++ /dev/null
@@ -1,222 +0,0 @@
-# Copyright 2015 NEC Corporation. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-import uuid
-
-from designateclient.tests import test_v1
-from designateclient import utils
-from designateclient import warlock
-
-
-Record = warlock.model_factory(utils.load_schema('v1', 'record'))
-
-DOMAIN = {
- "id": str(uuid.uuid4()),
- "name": "example.com."
-}
-
-
-class TestRecords(test_v1.APIV1TestCase, test_v1.CrudMixin):
- RESOURCE = 'records'
-
- def new_ref(self, **kwargs):
- ref = super(TestRecords, self).new_ref(**kwargs)
- ref.setdefault("name", uuid.uuid4().hex)
- ref.setdefault("type", "A")
- ref.setdefault("data", "10.0.0.1")
- return ref
-
- def test_create_record(self):
- ref = self.new_ref(id="2e32e609-3a4f-45ba-bdef-e50eacd345ad")
-
- parts = ["domains", DOMAIN["id"], self.RESOURCE]
- self.stub_url("POST", parts=parts, json=ref)
-
- values = ref.copy()
- del values["id"]
-
- self.client.records.create(DOMAIN['id'], Record(values))
- self.assertRequestBodyIs(json=values)
-
- def test_create_AAAA_record(self):
- ref = self.new_ref(id="11112222-3333-4444-5555-666677778888",
- type="AAAA",
- data="2001:db8:0:1234:0:5678:9:12")
-
- parts = ["domains", DOMAIN["id"], self.RESOURCE]
- self.stub_url("POST", parts=parts, json=ref)
-
- values = ref.copy()
- del values["id"]
-
- self.client.records.create(DOMAIN['id'], Record(values))
- self.assertRequestBodyIs(json=values)
-
- def test_create_MX_record(self):
- ref = self.new_ref(id="11112222-3333-4444-5555-666677778989",
- type="MX",
- data="mail.example.com.",
- priority=10)
-
- parts = ["domains", DOMAIN["id"], self.RESOURCE]
- self.stub_url("POST", parts=parts, json=ref)
-
- values = ref.copy()
- del values["id"]
-
- self.client.records.create(DOMAIN['id'], Record(values))
- self.assertRequestBodyIs(json=values)
-
- def test_create_CNAME_record(self):
- ref = self.new_ref(id="11112222-3333-4444-5555-666677778890",
- type="CNAME",
- data="example.com.")
-
- parts = ["domains", DOMAIN["id"], self.RESOURCE]
- self.stub_url("POST", parts=parts, json=ref)
-
- values = ref.copy()
- del values["id"]
-
- self.client.records.create(DOMAIN['id'], Record(values))
- self.assertRequestBodyIs(json=values)
-
- def test_create_TXT_record(self):
- ref = self.new_ref(id="11112222-3333-4444-5555-666677778889",
- type="TXT",
- data="This is a TXT record")
-
- parts = ["domains", DOMAIN["id"], self.RESOURCE]
- self.stub_url("POST", parts=parts, json=ref)
-
- values = ref.copy()
- del values["id"]
-
- self.client.records.create(DOMAIN['id'], Record(values))
- self.assertRequestBodyIs(json=values)
-
- def test_create_SRV_record(self):
- ref = self.new_ref(id="11112222-3333-4444-5555-666677778888",
- type="SRV",
- data="0 5060 sip.example.com.",
- priority=30)
-
- parts = ["domains", DOMAIN["id"], self.RESOURCE]
- self.stub_url("POST", parts=parts, json=ref)
-
- values = ref.copy()
- del values["id"]
-
- self.client.records.create(DOMAIN['id'], Record(values))
- self.assertRequestBodyIs(json=values)
-
- def test_create_NS_record(self):
- ref = self.new_ref(id="11112222-3333-4444-5555-666677779999",
- type="NS",
- data="ns1.example.com.")
-
- parts = ["domains", DOMAIN["id"], self.RESOURCE]
- self.stub_url("POST", parts=parts, json=ref)
-
- values = ref.copy()
- del values["id"]
-
- self.client.records.create(DOMAIN['id'], Record(values))
- self.assertRequestBodyIs(json=values)
-
- def test_create_PTR_record(self):
- ref = self.new_ref(id="11112222-3333-4444-5555-666677778891",
- type="PTR",
- data="www.example.com.")
-
- parts = ["domains", DOMAIN["id"], self.RESOURCE]
- self.stub_url("POST", parts=parts, json=ref)
-
- values = ref.copy()
- del values["id"]
-
- self.client.records.create(DOMAIN['id'], Record(values))
- self.assertRequestBodyIs(json=values)
-
- def test_create_SPF_record(self):
- ref = self.new_ref(id="11112222-3333-4444-5555-666677778899",
- type="SPF",
- data="v=spf1 +mx a:colo.example.com/28 -all")
-
- parts = ["domains", DOMAIN["id"], self.RESOURCE]
- self.stub_url("POST", parts=parts, json=ref)
-
- values = ref.copy()
- del values["id"]
-
- self.client.records.create(DOMAIN['id'], Record(values))
- self.assertRequestBodyIs(json=values)
-
- def test_create_SSHFP_record(self):
- ref = self.new_ref(id="11112222-3333-4444-5555-666677778888",
- type="SSHFP",
- data="2 1 6c3c958af43d953f91f40e0d84157f4fe7b4a898")
-
- parts = ["domains", DOMAIN["id"], self.RESOURCE]
- self.stub_url("POST", parts=parts, json=ref)
-
- values = ref.copy()
- del values["id"]
-
- self.client.records.create(DOMAIN['id'], Record(values))
- self.assertRequestBodyIs(json=values)
-
- def test_get(self):
- ref = self.new_ref(id="2e32e609-3a4f-45ba-bdef-e50eacd345ad")
-
- parts = ["domains", DOMAIN["id"], self.RESOURCE]
- self.stub_entity("GET", entity=ref, id=ref["id"], parts=parts)
-
- response = self.client.records.get(DOMAIN["id"], ref["id"])
- self.assertEqual(ref, response)
-
- def test_list(self):
- items = [
- self.new_ref(id="2e32e609-3a4f-45ba-bdef-e50eacd345ad"),
- self.new_ref(id="11112222-3333-4444-5555-666677778888")
- ]
-
- parts = ["domains", DOMAIN["id"], self.RESOURCE]
- self.stub_url("GET", parts=parts, json={"records": items})
-
- listed = self.client.records.list(DOMAIN["id"])
- self.assertList(items, listed)
- self.assertQueryStringIs("")
-
- def test_update(self):
- ref = self.new_ref(id="2e32e609-3a4f-45ba-bdef-e50eacd345ad",
- type="A",
- data="192.0.2.5")
-
- parts = ["domains", DOMAIN["id"], self.RESOURCE]
- self.stub_entity("PUT", entity=ref, id=ref["id"], parts=parts)
-
- values = ref.copy()
- del values["id"]
-
- self.client.records.update(DOMAIN["id"], Record(ref))
-
- def test_delete(self):
- ref = self.new_ref()
-
- parts = ["domains", DOMAIN["id"], self.RESOURCE]
- self.stub_entity("DELETE", id=ref["id"], parts=parts)
-
- self.client.records.delete(DOMAIN["id"], ref["id"])
- self.assertRequestBodyIs(None)
diff --git a/designateclient/tests/test_v1/test_reports.py b/designateclient/tests/test_v1/test_reports.py
deleted file mode 100644
index 0edd154..0000000
--- a/designateclient/tests/test_v1/test_reports.py
+++ /dev/null
@@ -1,54 +0,0 @@
-# Copyright 2015 NEC Corporation. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-import mock
-from mock import patch
-
-from designateclient.tests import test_v1
-from designateclient.v1 import reports
-
-
-class TestReports(test_v1.APIV1TestCase, test_v1.CrudMixin):
-
- @patch.object(reports.ReportsController, "count_all")
- def test_count_all(self, count_all):
- self.client.reports.count_all()
- self.client.reports.count_all.assert_called_with()
-
- @patch.object(reports.ReportsController, "count_domains")
- def test_count_domain(self, count_domains):
- self.client.reports.count_domains()
- self.client.reports.count_domains.assert_called_once_with()
-
- @patch.object(reports.ReportsController, "count_tenants")
- def test_count_tenants(self, count_tenants):
- self.client.reports.count_tenants()
- self.client.reports.count_tenants.assert_called_once_with()
-
- @patch.object(reports.ReportsController, "count_records")
- def test_count_records(self, count_records):
- self.client.reports.count_records()
- self.client.reports.count_records.assert_called_once_with()
-
- @patch.object(reports.ReportsController, "tenants_all")
- def test_tenants_all(self, tenants_all):
- self.client.reports.tenants_all()
- self.client.reports.tenants_all.assert_called_once_with()
-
- @patch.object(reports.ReportsController, "tenant_domains")
- def test_tenant_domains(self, tenant_domains):
- args = mock.MagicMock()
- args.other_tenant_id = "uuid"
- self.client.reports.tenant_domains(args.other_tenant_id)
- self.client.reports.tenant_domains.assert_called_once_with("uuid")
diff --git a/designateclient/tests/test_v1/test_servers.py b/designateclient/tests/test_v1/test_servers.py
deleted file mode 100644
index b8fa653..0000000
--- a/designateclient/tests/test_v1/test_servers.py
+++ /dev/null
@@ -1,95 +0,0 @@
-# Copyright 2015 NEC Corporation. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-import uuid
-
-import mock
-from mock import patch
-
-from designateclient.tests import test_v1
-from designateclient.v1 import servers
-
-
-class TestServers(test_v1.APIV1TestCase, test_v1.CrudMixin):
- RESOURCE = 'servers'
-
- def new_ref(self, **kwargs):
- ref = super(TestServers, self).new_ref(**kwargs)
- ref.setdefault("name", uuid.uuid4().hex)
- return ref
-
- def test_list(self):
- items = [
- self.new_ref(name="ns1.example.org.",
- id="89acac79-38e7-497d-807c-a011e1310438"),
- self.new_ref(name="ns2.example.org.",
- id="89acac79-38e7-497d-807c-a011e1310435")
- ]
-
- self.stub_url("GET", parts=[self.RESOURCE], json={"servers": items})
-
- listed = self.client.servers.list()
- self.assertList(items, listed)
- self.assertQueryStringIs("")
-
- def test_get(self):
- ref = self.new_ref(name="ns1.example.org.",
- id="89acac79-38e7-497d-807c-a011e1310438")
-
- self.stub_entity("GET", entity=ref, id=ref["id"])
-
- response = self.client.servers.get(ref["id"])
- self.assertEqual(ref, response)
-
- def test_create(self):
- ref = {"id": "89acac79-38e7-497d-807c-a011e1310438",
- "name": "ns1.example.org."}
-
- self.stub_url("POST", parts=[self.RESOURCE], json=ref)
-
- values = ref.copy()
- del values["id"]
-
- self.client.servers.create({"name": "ns1.example.org."})
- self.assertRequestBodyIs(json=values)
-
- def test_create_with_name_too_long(self):
- ref = {"id": "89acac79-38e7-497d-807c-a011e1310438",
- "name": "ns1." + "foo" * 85 + ".org."}
-
- self.stub_url("POST", parts=[self.RESOURCE], json=ref)
-
- values = ref.copy()
- del values["id"]
-
- self.assertRaises(ValueError, self.client.servers.create,
- {"name": "ns1.example.org."})
-
- @patch.object(servers.ServersController, "update")
- def test_update(self, server_update):
- ref = self.new_ref()
-
- self.stub_entity("PUT", entity=ref, id=ref["id"])
-
- mock_server = mock.MagicMock()
- self.client.servers.update(mock_server)
- self.client.servers.update.assert_called_with(mock_server)
-
- def test_delete(self):
- ref = self.new_ref()
-
- self.stub_entity("DELETE", id=ref["id"])
-
- self.client.servers.delete(ref["id"])
- self.assertRequestBodyIs(None)
diff --git a/designateclient/tests/test_v1/test_sync.py b/designateclient/tests/test_v1/test_sync.py
deleted file mode 100644
index 88ad5d1..0000000
--- a/designateclient/tests/test_v1/test_sync.py
+++ /dev/null
@@ -1,42 +0,0 @@
-# Copyright 2015 NEC Corporation. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-import mock
-from mock import patch
-
-from designateclient.tests import test_v1
-from designateclient.v1 import sync
-
-
-class TestSync(test_v1.APIV1TestCase, test_v1.CrudMixin):
-
- @patch.object(sync.SyncController, "sync_all")
- def test_sync_all(self, sync_all):
- self.client.sync.sync_all()
- self.client.sync.sync_all.assert_called_with()
-
- @patch.object(sync.SyncController, "sync_domain")
- def test_sync_domain(self, sync_domain):
- args = mock.MagicMock()
- args.tenant_id = "1234"
- self.client.sync.sync_domain(args.tenant_id)
- self.client.sync.sync_domain.assert_called_with("1234")
-
- @patch.object(sync.SyncController, "sync_record")
- def test_sync_record(self, sync_record):
- args = mock.MagicMock()
- args.tenant_id = "1234"
- args.record_id = "uuid"
- self.client.sync.sync_record(args.tenant_id, args.record_id)
- self.client.sync.sync_record.assert_called_with("1234", "uuid")
diff --git a/designateclient/tests/test_v1/test_touch.py b/designateclient/tests/test_v1/test_touch.py
deleted file mode 100644
index 5c944b0..0000000
--- a/designateclient/tests/test_v1/test_touch.py
+++ /dev/null
@@ -1,29 +0,0 @@
-# Copyright 2015 NEC Corporation. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-import mock
-from mock import patch
-
-from designateclient.tests import test_v1
-from designateclient.v1 import touch
-
-
-class TestTouch(test_v1.APIV1TestCase, test_v1.CrudMixin):
-
- @patch.object(touch.TouchController, "domain")
- def test_domain(self, domain):
- args = mock.MagicMock()
- args.domain_id = "1234"
- self.client.touch.domain(args.domain_id)
- self.client.touch.domain.assert_called_with("1234")