1 #!/usr/bin/python 2 # Copyright (c) 2013 The Chromium OS Authors. All rights reserved. 3 # Use of this source code is governed by a BSD-style license that can be 4 # found in the LICENSE file. 5 # pylint: disable-msg=C0111 6 7 import unittest 8 import common 9 from autotest_lib.site_utils import test_that 10 11 12 class TestThatUnittests(unittest.TestCase): 13 def test_validate_arguments(self): 14 # Deferred until validate_arguments allows for lab runs. 15 pass 16 17 def test_parse_arguments(self): 18 args = test_that.parse_arguments( 19 ['-b', 'some_board', '-i', 'some_image', '--args', 'some_args', 20 'some_remote', 'test1', 'test2']) 21 self.assertEqual('some_board', args.board) 22 self.assertEqual('some_image', args.build) 23 self.assertEqual('some_args', args.args) 24 self.assertEqual('some_remote', args.remote) 25 self.assertEqual(['test1', 'test2'], args.tests) 26 27 def test_parse_arguments_internal(self): 28 args, remote_argv = test_that._parse_arguments_internal( 29 ['-b', 'some_board', '-i', 'some_image', '--args', 'some_args', 30 'some_remote', 'test1', 'test2']) 31 self.assertEqual('some_board', args.board) 32 self.assertEqual('some_image', args.build) 33 self.assertEqual('some_args', args.args) 34 self.assertEqual('some_remote', args.remote) 35 self.assertEqual(['test1', 'test2'], args.tests) 36 self.assertEqual(remote_argv, 37 ['-b', 'some_board', '-i', 'some_image', '--args', 38 'some_args', 'some_remote', 'test1', 'test2']) 39 40 def test_parse_arguments_internal_with_local_argument(self): 41 args, remote_argv = test_that._parse_arguments_internal( 42 ['-b', 'some_board', '-i', 'some_image', '-w', 'server:port', 43 '--args', 'some_args', 'some_remote', 'test1', 'test2']) 44 self.assertEqual('server:port', args.web) 45 self.assertEqual('some_board', args.board) 46 self.assertEqual('some_image', args.build) 47 self.assertEqual('some_args', args.args) 48 self.assertEqual('some_remote', args.remote) 49 self.assertEqual(['test1', 'test2'], args.tests) 50 self.assertEqual(remote_argv, 51 ['-b', 'some_board', '-i', 'some_image', '--args', 52 'some_args', 'some_remote', 'test1', 'test2']) 53 54 def test_parse_arguments_with_local_argument(self): 55 args = test_that.parse_arguments( 56 ['-b', 'some_board', '-i', 'some_image', '-w', 'server:port', 57 '--args', 'some_args', 'some_remote', 'test1', 'test2']) 58 self.assertEqual('server:port', args.web) 59 self.assertEqual('some_board', args.board) 60 self.assertEqual('some_image', args.build) 61 self.assertEqual('some_args', args.args) 62 self.assertEqual('some_remote', args.remote) 63 self.assertEqual(['test1', 'test2'], args.tests) 64 65 def test_fetch_local_suite(self): 66 # Deferred until fetch_local_suite knows about non-local builds. 67 pass 68 69 70 if __name__ == '__main__': 71 unittest.main() 72