Attached is the CLI code tarball. It is documented at http://test.kernel.org/autotest/CLIHowTo

From: [email protected]



git-svn-id: http://test.kernel.org/svn/autotest/trunk@1950 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/cli/rpc_unittest.py b/cli/rpc_unittest.py
new file mode 100755
index 0000000..184acef
--- /dev/null
+++ b/cli/rpc_unittest.py
@@ -0,0 +1,46 @@
+#!/usr/bin/python
+#
+# Copyright 2008 Google Inc. All Rights Reserved.
+
+"""Test for the rpc proxy class."""
+
+import unittest, os
+import common
+from autotest_lib.cli import rpc
+from autotest_lib.frontend.afe import rpc_client_lib
+from autotest_lib.frontend.afe.json_rpc import proxy
+
+
+class rpc_unittest(unittest.TestCase):
+    def setUp(self):
+        self.old_environ = os.environ
+        if 'AUTOTEST_WEB' in os.environ:
+            del os.environ['AUTOTEST_WEB']
+
+
+    def tearDown(self):
+        os.environ = self.old_environ
+
+
+    def test_get_autotest_server_specific(self):
+        self.assertEqual('http://foo', rpc.get_autotest_server('foo'))
+
+
+    def test_get_autotest_server_none(self):
+        self.assertEqual('http://autotest', rpc.get_autotest_server(None))
+
+
+    def test_get_autotest_server_environ(self):
+        os.environ['AUTOTEST_WEB'] = 'foo-dev'
+        self.assertEqual('http://foo-dev', rpc.get_autotest_server(None))
+        del os.environ['AUTOTEST_WEB']
+
+
+    def test_get_autotest_server_environ_precedence(self):
+        os.environ['AUTOTEST_WEB'] = 'foo-dev'
+        self.assertEqual('http://foo', rpc.get_autotest_server('foo'))
+        del os.environ['AUTOTEST_WEB']
+
+
+if __name__ == '__main__':
+    unittest.main()