]> granicus.if.org Git - pdns/commitdiff
webserver: add (failing) test: zone create with slash
authorChristian Hofstaedtler <christian@hofstaedtler.name>
Tue, 28 Jan 2014 08:43:37 +0000 (09:43 +0100)
committerChristian Hofstaedtler <christian@hofstaedtler.name>
Tue, 28 Jan 2014 08:55:25 +0000 (09:55 +0100)
regression-tests.api/test_Zones.py

index 42e09f57afdcb40b8f1263b79ecf81a018535bda..fc438f1592eeb012bc7799ef5da80945d71d2385 100644 (file)
@@ -33,6 +33,27 @@ class Servers(ApiTestCase):
             if k in payload:
                 self.assertEquals(data[k], payload[k])
 
+    @unittest.expectedFailure
+    def test_CreateZoneWithSymbols(self):
+        payload = {
+            'name': 'foo/bar.'+unique_zone_name(),
+            'kind': 'Native',
+            'nameservers': ['ns1.foo.com', 'ns2.foo.com']
+        }
+        expected_id = payload['name']
+        expected_id.replace('/', '\047')
+        r = self.session.post(
+            self.url("/servers/localhost/zones"),
+            data=json.dumps(payload),
+            headers={'content-type': 'application/json'})
+        self.assertSuccessJson(r)
+        data = r.json()
+        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])
+        self.assertEquals(data[k], expected_id)
+
     def test_GetZone(self):
         r = self.session.get(self.url("/servers/localhost/zones"))
         domains = r.json()