Document doc;
doc.SetObject();
- doc.AddMember("name", zonename.c_str(), doc.GetAllocator());
+ // id is the canonical lookup key, which doesn't actually match the name (in some cases)
+ doc.AddMember("id", di.zone.c_str(), doc.GetAllocator());
+ string url = (boost::format("/servers/localhost/zones/%s") % di.zone).str();
+ Value jurl(url.c_str(), doc.GetAllocator()); // copy
+ doc.AddMember("url", jurl, doc.GetAllocator());
+ doc.AddMember("name", di.zone.c_str(), doc.GetAllocator());
doc.AddMember("type", "Zone", doc.GetAllocator());
doc.AddMember("kind", di.getKindString(), doc.GetAllocator());
Value masters;
BOOST_FOREACH(const DomainInfo& di, domains) {
Value jdi;
jdi.SetObject();
+ // id is the canonical lookup key, which doesn't actually match the name (in some cases)
+ jdi.AddMember("id", di.zone.c_str(), doc.GetAllocator());
+ string url = (boost::format("/servers/localhost/zones/%s") % di.zone).str();
+ Value jurl(url.c_str(), doc.GetAllocator()); // copy
+ jdi.AddMember("url", jurl, doc.GetAllocator());
jdi.AddMember("name", di.zone.c_str(), doc.GetAllocator());
jdi.AddMember("kind", di.getKindString(), doc.GetAllocator());
Value masters;
example_com = [domain for domain in domains if domain['name'] == u'example.com']
self.assertEquals(len(example_com), 1)
example_com = example_com[0]
- for k in ('name', 'masters', 'kind', 'last_check', 'notified_serial', 'serial'):
+ for k in ('id', 'url', 'name', 'masters', 'kind', 'last_check', 'notified_serial', 'serial'):
self.assertIn(k, example_com)
def test_CreateZone(self):
headers={'content-type': 'application/json'})
self.assertSuccessJson(r)
data = r.json()
- for k in ('name', 'masters', 'kind', 'last_check', 'notified_serial', 'serial'):
+ for k in ('id', 'url', 'name', 'masters', 'kind', 'last_check', 'notified_serial', 'serial'):
self.assertIn(k, data)
if k in payload:
self.assertEquals(data[k], payload[k])