]>
Commit | Line | Data |
---|---|---|
41942bb3 CH |
1 | import json |
2 | import requests | |
3 | import unittest | |
4 | from test_helper import ApiTestCase, isRecursor | |
5 | ||
6 | ||
7 | @unittest.skipIf(not isRecursor(), "Only applicable to recursors") | |
8 | class RecursorConfig(ApiTestCase): | |
9 | ||
10 | def test_ConfigAllowFromGet(self): | |
11 | r = self.session.get(self.url("/servers/localhost/config/allow-from")) | |
12 | self.assertSuccessJson(r) | |
13 | ||
14 | def test_ConfigAllowFromReplace(self): | |
bd0320fe | 15 | payload = {'value': ["127.0.0.1"]} |
41942bb3 CH |
16 | r = self.session.put( |
17 | self.url("/servers/localhost/config/allow-from"), | |
18 | data=json.dumps(payload), | |
19 | headers={'content-type': 'application/json'}) | |
20 | self.assertSuccessJson(r) | |
21 | data = r.json() | |
bd0320fe | 22 | self.assertEquals("127.0.0.1/32", data["value"][0]) |