Aviv Keshet | b1238c3 | 2013-04-01 11:42:13 -0700 | [diff] [blame^] | 1 | #!/usr/bin/python |
| 2 | |
| 3 | # Copyright (c) 2013 The Chromium OS Authors. All rights reserved. |
| 4 | # Use of this source code is governed by a BSD-style license that can be |
| 5 | # found in the LICENSE file. |
| 6 | |
| 7 | """Unit tests for autotest_quickmerge.""" |
| 8 | |
| 9 | from chromite.lib import cros_build_lib_unittest |
| 10 | from chromite.lib import cros_test_lib |
| 11 | from chromite.scripts import autotest_quickmerge |
| 12 | |
| 13 | class RsyncCommandTest(cros_build_lib_unittest.RunCommandTestCase): |
| 14 | |
| 15 | def testRsyncQuickmergeCommand(self): |
| 16 | """Test that RsyncQuickMerge makes correct call to SudoRunCommand""" |
| 17 | include_file_name = 'an_include_file_name' |
| 18 | source_path = 'a_source_path' |
| 19 | sysroot_path = 'a_sysroot_path' |
| 20 | |
| 21 | expected_command = ['rsync', '-a', '-n', '-u', '-i', |
| 22 | '--exclude=**.pyc', '--exclude=**.pyo', |
| 23 | '--include-from=%s' % include_file_name, |
| 24 | '--exclude=*', |
| 25 | source_path, |
| 26 | sysroot_path] |
| 27 | |
| 28 | autotest_quickmerge.RsyncQuickmerge(source_path, sysroot_path, |
| 29 | include_file_name, |
| 30 | pretend=True, |
| 31 | overwrite=False, |
| 32 | quiet=False) |
| 33 | |
| 34 | self.assertCommandContains(expected_command) |
| 35 | |
| 36 | |
| 37 | if __name__ == '__main__': |
| 38 | cros_test_lib.main() |