]> git.ipfire.org Git - thirdparty/pdns.git/blob - regression-tests.api/test_Cache.py
6a3f618d51cf84686dafbeb5c83590009be2faf1
[thirdparty/pdns.git] / regression-tests.api / test_Cache.py
1 from test_helper import ApiTestCase, is_auth, is_recursor
2
3
4 class Servers(ApiTestCase):
5
6 def test_flush(self):
7 r = self.session.put(self.url("/api/v1/servers/localhost/cache/flush?domain=example.org."))
8 self.assert_success_json(r)
9 data = r.json()
10 self.assertIn('count', data)
11
12 def test_flush_root(self):
13 r = self.session.put(self.url("/api/v1/servers/localhost/cache/flush?domain=."))
14 self.assert_success_json(r)
15 data = r.json()
16 self.assertIn('count', data)
17 self.assertEqual(data['result'], 'Flushed cache.')
18
19 def test_flush_no_domain(self):
20 r = self.session.put(
21 self.url("/api/v1/servers/localhost/cache/flush"))
22 self.assertEquals(r.status_code, 422)
23
24 def test_flush_unqualified(self):
25 r = self.session.put(
26 self.url("/api/v1/servers/localhost/cache/flush?domain=bar"))
27 self.assertEquals(r.status_code, 422)