self.url("/api/v1/servers/localhost/zones/" + name),
data=json.dumps(payload),
headers={'content-type': 'application/json'})
- self.assert_success_json(r)
- data = r.json()
+ self.assert_success(r)
+ data = self.session.get(self.url("/api/v1/servers/localhost/zones/" + name)).json()
for k in payload.keys():
self.assertIn(k, data)
self.assertEquals(data[k], payload[k])
self.url("/api/v1/servers/localhost/zones/" + name),
data=json.dumps(payload),
headers={'content-type': 'application/json'})
- self.assert_success_json(r)
- data = r.json()
+ self.assert_success(r)
+ data = self.session.get(self.url("/api/v1/servers/localhost/zones/" + name)).json()
for k in payload.keys():
self.assertIn(k, data)
self.assertEquals(data[k], payload[k])
self.url("/api/v1/servers/localhost/zones/" + name),
data=json.dumps(payload),
headers={'content-type': 'application/json'})
- self.assert_success_json(r)
+ self.assert_success(r)
# verify that (only) the new record is there
- r = self.session.get(self.url("/api/v1/servers/localhost/zones/" + name))
- data = r.json()
+ data = self.session.get(self.url("/api/v1/servers/localhost/zones/" + name)).json()
self.assertEquals(get_rrset(data, name, 'NS')['records'], rrset['records'])
def test_zone_rr_update_mx(self):
self.url("/api/v1/servers/localhost/zones/" + name),
data=json.dumps(payload),
headers={'content-type': 'application/json'})
- self.assert_success_json(r)
+ self.assert_success(r)
# verify that (only) the new record is there
- r = self.session.get(self.url("/api/v1/servers/localhost/zones/" + name))
- data = r.json()
+ data = self.session.get(self.url("/api/v1/servers/localhost/zones/" + name)).json()
self.assertEquals(get_rrset(data, name, 'MX')['records'], rrset['records'])
def test_zone_rr_update_multiple_rrsets(self):
self.url("/api/v1/servers/localhost/zones/" + name),
data=json.dumps(payload),
headers={'content-type': 'application/json'})
- self.assert_success_json(r)
+ self.assert_success(r)
# verify that all rrsets have been updated
- r = self.session.get(self.url("/api/v1/servers/localhost/zones/" + name))
- data = r.json()
+ data = self.session.get(self.url("/api/v1/servers/localhost/zones/" + name)).json()
self.assertEquals(get_rrset(data, name, 'NS')['records'], rrset1['records'])
self.assertEquals(get_rrset(data, name, 'MX')['records'], rrset2['records'])
self.url("/api/v1/servers/localhost/zones/" + name),
data=json.dumps(payload),
headers={'content-type': 'application/json'})
- self.assert_success_json(r)
+ self.assert_success(r)
# verify that the records are gone
- r = self.session.get(self.url("/api/v1/servers/localhost/zones/" + name))
- data = r.json()
+ data = self.session.get(self.url("/api/v1/servers/localhost/zones/" + name)).json()
self.assertIsNone(get_rrset(data, name, 'NS'))
def test_zone_disable_reenable(self):
self.url("/api/v1/servers/localhost/zones/" + name),
data=json.dumps(payload),
headers={'content-type': 'application/json'})
- self.assert_success_json(r)
+ self.assert_success(r)
# check SOA serial has been edited
- soa_serial1 = get_first_rec(r.json(), name, 'SOA')['content'].split()[2]
+ data = self.session.get(self.url("/api/v1/servers/localhost/zones/" + name)).json()
+ soa_serial1 = get_first_rec(data, name, 'SOA')['content'].split()[2]
self.assertNotEquals(soa_serial1, '1')
# make sure domain is still in zone list (disabled SOA!)
r = self.session.get(self.url("/api/v1/servers/localhost/zones"))
self.url("/api/v1/servers/localhost/zones/" + name),
data=json.dumps(payload),
headers={'content-type': 'application/json'})
- self.assert_success_json(r)
+ self.assert_success(r)
# check SOA serial has been edited again
- print r.json()
- soa_serial2 = get_first_rec(r.json(), name, 'SOA')['content'].split()[2]
+ data = self.session.get(self.url("/api/v1/servers/localhost/zones/" + name)).json()
+ soa_serial2 = get_first_rec(data, name, 'SOA')['content'].split()[2]
self.assertNotEquals(soa_serial2, '1')
self.assertNotEquals(soa_serial2, soa_serial1)
data=json.dumps(payload),
headers={'content-type': 'application/json'})
print r.content
- self.assertEquals(r.status_code, 200) # succeed so users can fix their wrong, old data
+ self.assert_success(r) # succeed so users can fix their wrong, old data
def test_zone_delete(self):
name, payload, zone = self.create_zone()
self.url("/api/v1/servers/localhost/zones/" + name),
data=json.dumps(payload),
headers={'content-type': 'application/json'})
- self.assert_success_json(r)
+ self.assert_success(r)
# make sure the comments have been set, and that the NS
# records are still present
- r = self.session.get(self.url("/api/v1/servers/localhost/zones/" + name))
- serverset = get_rrset(r.json(), name, 'NS')
+ data = self.session.get(self.url("/api/v1/servers/localhost/zones/" + name)).json()
+ serverset = get_rrset(data, name, 'NS')
print serverset
self.assertNotEquals(serverset['records'], [])
self.assertNotEquals(serverset['comments'], [])
self.url("/api/v1/servers/localhost/zones/" + name),
data=json.dumps(payload),
headers={'content-type': 'application/json'})
- self.assert_success_json(r)
+ self.assert_success(r)
# make sure the NS records are still present
- r = self.session.get(self.url("/api/v1/servers/localhost/zones/" + name))
- serverset = get_rrset(r.json(), name, 'NS')
+ data = self.session.get(self.url("/api/v1/servers/localhost/zones/" + name)).json()
+ serverset = get_rrset(data, name, 'NS')
print serverset
self.assertNotEquals(serverset['records'], [])
self.assertEquals(serverset['comments'], [])
self.url("/api/v1/servers/localhost/zones/" + name),
data=json.dumps(payload),
headers={'content-type': 'application/json'})
- self.assert_success_json(r)
+ self.assert_success(r)
# replace rrset records
rrset2 = {
'changetype': 'replace',
self.url("/api/v1/servers/localhost/zones/" + name),
data=json.dumps(payload2),
headers={'content-type': 'application/json'})
- self.assert_success_json(r)
+ self.assert_success(r)
# make sure the comments still exist
- r = self.session.get(self.url("/api/v1/servers/localhost/zones/" + name))
- serverset = get_rrset(r.json(), name, 'NS')
+ data = self.session.get(self.url("/api/v1/servers/localhost/zones/" + name)).json()
+ serverset = get_rrset(data, name, 'NS')
print serverset
self.assertEquals(serverset['records'], rrset2['records'])
self.assertEquals(serverset['comments'], rrset['comments'])
self.url("/api/v1/servers/localhost/zones/" + name),
data=json.dumps(payload),
headers={'content-type': 'application/json'})
- self.assert_success_json(r)
+ self.assert_success(r)
r = self.session.get(self.url("/api/v1/servers/localhost/zones/" + revzone)).json()
revsets = [s for s in r['rrsets'] if s['type'] == 'PTR']
print revsets
self.url("/api/v1/servers/localhost/zones/" + name),
data=json.dumps(payload),
headers={'content-type': 'application/json'})
- self.assert_success_json(r)
+ self.assert_success(r)
r = self.session.get(self.url("/api/v1/servers/localhost/zones/" + revzone)).json()
revsets = [s for s in r['rrsets'] if s['type'] == 'PTR']
print revsets
self.url("/api/v1/servers/localhost/zones/" + zone_id),
data=json.dumps(payload),
headers={'content-type': 'application/json'})
- self.assert_success_json(r)
- data = r.json()
+ self.assert_success(r)
+ data = self.session.get(self.url("/api/v1/servers/localhost/zones/" + zone_id)).json()
for k in payload.keys():
self.assertIn(k, data)
self.assertEquals(data[k], payload[k])
self.url("/api/v1/servers/localhost/zones/" + zone_id),
data=json.dumps(payload),
headers={'content-type': 'application/json'})
- self.assert_success_json(r)
- data = r.json()
+ self.assert_success(r)
+ data = self.session.get(self.url("/api/v1/servers/localhost/zones/" + zone_id)).json()
for k in payload.keys():
self.assertIn(k, data)
self.assertEquals(data[k], payload[k])
self.url("/api/v1/servers/localhost/zones/" + name),
data=json.dumps(payload),
headers={'content-type': 'application/json'})
- self.assert_success_json(r)
- data = r.json()
+ self.assert_success(r)
+ data = self.session.get(self.url("/api/v1/servers/localhost/zones/" + payload['name'])).json()
for k in payload.keys():
self.assertEquals(data[k], payload[k])