BIND 10 trac2641_3, updated. 77520e9dda0fc9cac5bbd8bdf7225ecc52bd8ed5 [2641] Test that _try_login() makes the right API call to cmdctl
BIND 10 source code commits
bind10-changes at lists.isc.org
Tue Feb 19 06:11:58 UTC 2013
The branch, trac2641_3 has been updated
via 77520e9dda0fc9cac5bbd8bdf7225ecc52bd8ed5 (commit)
from 0abfd1c9e17568e36411cfc30e5e084fa84c92df (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 77520e9dda0fc9cac5bbd8bdf7225ecc52bd8ed5
Author: Mukund Sivaraman <muks at isc.org>
Date: Tue Feb 19 11:41:47 2013 +0530
[2641] Test that _try_login() makes the right API call to cmdctl
-----------------------------------------------------------------------
Summary of changes:
src/bin/bindctl/tests/bindctl_test.py | 38 +++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
-----------------------------------------------------------------------
diff --git a/src/bin/bindctl/tests/bindctl_test.py b/src/bin/bindctl/tests/bindctl_test.py
index b28e640..344b198 100644
--- a/src/bin/bindctl/tests/bindctl_test.py
+++ b/src/bin/bindctl/tests/bindctl_test.py
@@ -458,6 +458,44 @@ class TestConfigCommands(unittest.TestCase):
finally:
self.tool.send_POST = orig_send_POST
+ def test_try_login_calls_cmdctl(self):
+ # Make sure _try_login() makes the right API call to cmdctl.
+ orig_conn = self.tool.conn
+ try:
+ class MyConn:
+ def __init__(self):
+ self.method = None
+ self.url = None
+ self.param = None
+ self.headers = None
+
+ def request(self, method, url, param, headers):
+ self.method = method
+ self.url = url
+ self.param = param
+ self.headers = headers
+
+ def getresponse(self):
+ class MyResponse:
+ def __init__(self):
+ self.status = http.client.OK
+ def read(self):
+ class MyData:
+ def decode(self):
+ return json.dumps(True)
+ return MyData()
+ return MyResponse()
+
+ self.tool.conn = MyConn()
+ self.assertTrue(self.tool._try_login('user32', 'pass64'))
+ self.assertEqual(self.tool.conn.method, 'POST')
+ self.assertEqual(self.tool.conn.url, '/login')
+ self.assertEqual(json.loads(self.tool.conn.param),
+ {"password": "pass64", "username": "user32"})
+ self.assertIn('cookie', self.tool.conn.headers)
+ finally:
+ self.tool.conn = orig_conn
+
def test_have_users(self):
# Make sure _have_users raises the correct exception
# upon failure of either send_POST or the read() on the
More information about the bind10-changes
mailing list