Fix the v2 XFR task API

* Fixed the call to non existent function
* Added unit tests

Change-Id: I8c88fc1ea353e99b7a0b5bb0aa5c8d7e2bf92328
Closes-Bug: 1459487
This commit is contained in:
Graham Hayes 2015-05-28 17:52:28 +01:00
parent 5d4eeca3e5
commit 1cb65e2516
2 changed files with 32 additions and 1 deletions

View File

@ -29,7 +29,7 @@ class XfrController(rest.RestController):
response = pecan.response
context = request.environ['context']
self.central_api.perform_zone_xfr(context, zone_id)
self.central_api.xfr_domain(context, zone_id)
response.status_int = 202
# NOTE: This is a hack and a half.. But Pecan needs it.

View File

@ -461,6 +461,37 @@ class ApiV2ZonesTest(ApiV2TestCase):
self.assertEqual(masters, response.json['masters'])
self.assertEqual(1, response.json['serial'])
def test_xfr_request(self):
# Create a zone
fixture = self.get_domain_fixture('SECONDARY', 0)
fixture['email'] = cfg.CONF['service:central'].managed_resource_email
fixture['attributes'] = [{"key": "master", "value": "10.0.0.10"}]
# Create a zone
zone = self.create_domain(**fixture)
response = self.client.post_json(
'/zones/%s/tasks/xfr' % zone['id'],
None, status=202)
# Check the headers are what we expect
self.assertEqual(202, response.status_int)
self.assertEqual('application/json', response.content_type)
def test_invalid_xfr_request(self):
# Create a zone
# Create a zone
zone = self.create_domain()
response = self.client.post_json(
'/zones/%s/tasks/xfr' % zone['id'],
None, status=400)
# Check the headers are what we expect
self.assertEqual(400, response.status_int)
self.assertEqual('application/json', response.content_type)
def test_update_secondary_email_invalid_object(self):
# Create a zone
fixture = self.get_domain_fixture('SECONDARY', 0)