rr.ttl = intFromJson(record, "ttl");
rr.disabled = boolFromJson(record, "disabled");
+ if (rr.qtype.getCode() == 0) {
+ throw ApiException("Record "+rr.qname+"/"+stringFromJson(record, "type")+" is of unknown type");
+ }
+
try {
shared_ptr<DNSRecordContent> drc(DNSRecordContent::mastermake(rr.qtype.getCode(), 1, rr.content));
string tmp = drc->serialize(rr.qname);
self.assertEquals(r.status_code, 422)
self.assertIn('out of zone', r.json()['error'])
+ def test_rrset_unknown_type(self):
+ payload, zone = self.create_zone()
+ name = payload['name']
+ rrset = {
+ 'changetype': 'replace',
+ 'name': name,
+ 'type': 'FAFAFA',
+ 'records': [
+ {
+ "name": name,
+ "type": "FAFAFA",
+ "ttl": 3600,
+ "content": "4.3.2.1",
+ "disabled": False
+ }
+ ]
+ }
+ payload = {'rrsets': [rrset]}
+ r = self.session.patch(self.url("/servers/localhost/zones/" + name), data=json.dumps(payload),
+ headers={'content-type': 'application/json'})
+ self.assertEquals(r.status_code, 422)
+ self.assertIn('unknown type', r.json()['error'])
+
def test_zone_rr_delete_out_of_zone(self):
payload, zone = self.create_zone()
name = payload['name']