Move the cli RPC authorization_headers code into rpc_client_lib.
Make autotest_lib.server.frontend use it for RPC authentication.
Signed-off-by: Gregory Smith <gps@google.com>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@4231 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/server/frontend_unittest.py b/server/frontend_unittest.py
index d5b19dc..e72ccf7 100755
--- a/server/frontend_unittest.py
+++ b/server/frontend_unittest.py
@@ -37,6 +37,9 @@
def test_init(self):
os.environ['LOGNAME'] = 'unittest-user'
GLOBAL_CONFIG.override_config_value('SERVER', 'hostname', 'test-host')
+ rpc_client_lib.authorization_headers.expect_call(
+ 'unittest-user', 'http://test-host').and_return(
+ {'AUTHORIZATION': 'unittest-user'})
rpc_client_lib.get_proxy.expect_call(
'http://test-host/path',
headers={'AUTHORIZATION': 'unittest-user'})
@@ -52,8 +55,11 @@
id = 'idFoo'
results_platform_map = {'NORAD' : {'Seeking_Joshua': ['WOPR']}}
GLOBAL_CONFIG.override_config_value('SERVER', 'hostname', 'chess')
+ rpc_client_lib.authorization_headers.expect_call(
+ 'david', 'http://chess').and_return(
+ {'AUTHORIZATION': 'david'})
rpc_client_lib.get_proxy.expect_call(
- 'http://chess/afe/server/noauth/rpc/',
+ 'http://chess/afe/server/rpc/',
headers={'AUTHORIZATION': 'david'})
self.god.stub_function(utils, 'send_email')
utils.send_email.expect_any_call()