]> granicus.if.org Git - pdns/commitdiff
auth: Add an API test for multiple CNAME records in the same RRset
authorRemi Gacogne <remi.gacogne@powerdns.com>
Wed, 12 Dec 2018 13:35:32 +0000 (14:35 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Wed, 12 Dec 2018 15:38:08 +0000 (16:38 +0100)
(cherry picked from commit 8b1fa85de2f5cd33ce84f78de3a700bc5d2fb512)

regression-tests.api/test_Zones.py

index db971e0a1661261eaebfe9302aa6243ad5dceb10..ecbb43d0a6c2ea1d0578e49f49d356ed7e0066ce 100644 (file)
@@ -1201,6 +1201,30 @@ fred   IN  A      192.168.0.4
         self.assertEquals(r.status_code, 422)
         self.assertIn('Conflicts with pre-existing CNAME RRset', r.json()['error'])
 
+    def test_rrset_multiple_cnames(self):
+        name, payload, zone = self.create_zone()
+        rrset = {
+            'changetype': 'replace',
+            'name': 'sub.'+name,
+            'type': 'CNAME',
+            'ttl': 3600,
+            'records': [
+                {
+                    "content": "01.example.org.",
+                    "disabled": False
+                },
+                {
+                    "content": "02.example.org.",
+                    "disabled": False
+                }
+            ]
+        }
+        payload = {'rrsets': [rrset]}
+        r = self.session.patch(self.url("/api/v1/servers/localhost/zones/" + name), data=json.dumps(payload),
+                               headers={'content-type': 'application/json'})
+        self.assertEquals(r.status_code, 422)
+        self.assertIn('/CNAME has more than one record', r.json()['error'])
+
     def test_create_zone_with_leading_space(self):
         # Actual regression.
         name, payload, zone = self.create_zone()