Index: native_client_sdk/src/tools/tests/getos_test.py |
diff --git a/native_client_sdk/src/tools/tests/getos_test.py b/native_client_sdk/src/tools/tests/getos_test.py |
index f47fffb11ab6d0e9cad46bd3b06c58942c4fe6d6..710ec52febeb2c3096bfffa2adca81d2cb2679f1 100755 |
--- a/native_client_sdk/src/tools/tests/getos_test.py |
+++ b/native_client_sdk/src/tools/tests/getos_test.py |
@@ -12,7 +12,7 @@ import unittest |
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) |
TOOLS_DIR = os.path.dirname(SCRIPT_DIR) |
CHROME_SRC = os.path.dirname(os.path.dirname(os.path.dirname(TOOLS_DIR))) |
-MOCK_DIR = os.path.join(CHROME_SRC, "third_party", "pymock") |
+MOCK_DIR = os.path.join(CHROME_SRC, 'third_party', 'pymock') |
# For the mock library |
sys.path.append(MOCK_DIR) |
@@ -103,6 +103,24 @@ class TestGetos(TestCaseExtended): |
arch = getos.GetNaClArch(platform) |
self.assertIn(arch, ('x86_64', 'x86_32', 'arm')) |
+ def testMainInvalidArgs(self): |
+ with self.assertRaises(SystemExit): |
+ with mock.patch('sys.stderr'): |
+ getos.main('--foo') |
+ |
+ @mock.patch('sys.stdout', mock.Mock()) |
+ @mock.patch('getos.GetPlatform') |
+ def testMainNoArgs(self, mock_get_platform): |
+ mock_get_platform.return_value = 'platform' |
+ getos.main([]) |
+ |
+ @mock.patch('sys.stdout', mock.Mock()) |
+ @mock.patch('getos.GetSystemArch') |
+ def testMainArgsParsing(self, mock_system_arch): |
+ mock_system_arch.return_value = 'dummy' |
+ getos.main(['--arch']) |
+ mock_system_arch.assert_called() |
+ |
class TestGetosWithTempdir(TestCaseExtended): |
def setUp(self): |