summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshoward <showard@592f7852-d20e-0410-864c-8624ca9c26a4>2009-05-01 00:09:36 +0000
committershoward <showard@592f7852-d20e-0410-864c-8624ca9c26a4>2009-05-01 00:09:36 +0000
commitee0992a7d62ae78cde0c98751b1bfaa487be26e3 (patch)
tree1161b82a0989a5201f0f397f78f0282b1ea37aa7
parentdd36e1a94cc83772f2f2bb6389c3f484583f9c62 (diff)
Fix CLI unittests to call check_playback in all cases, not just when
run_cmd is used. Signed-off-by: Gregory Smith <gps@google.com> git-svn-id: svn://test.kernel.org/autotest/trunk@3075 592f7852-d20e-0410-864c-8624ca9c26a4
-rwxr-xr-xcli/job_unittest.py29
1 files changed, 22 insertions, 7 deletions
diff --git a/cli/job_unittest.py b/cli/job_unittest.py
index fbf38884..ffbfae37 100755
--- a/cli/job_unittest.py
+++ b/cli/job_unittest.py
@@ -10,6 +10,7 @@ import copy, getpass, unittest, sys, os
import common
from autotest_lib.cli import cli_mock, topic_common, job
+from autotest_lib.client.common_lib.test_utils import mock
class job_unittest(cli_mock.cli_unittest):
@@ -207,14 +208,17 @@ class job_list_unittest(job_unittest):
'Created'])
+class job_list_jobs_all_and_user_unittest(cli_mock.cli_unittest):
def test_job_list_jobs_all_and_user(self):
testjob = job.job_list()
sys.argv = ['atest', 'job', 'list', '-a', '-u', 'user0',
'--ignore_site_file']
self.god.mock_io()
- sys.exit.expect_call(1).and_raises(cli_mock.ExitException)
+ (sys.exit.expect_call(mock.anything_comparator())
+ .and_raises(cli_mock.ExitException))
self.assertRaises(cli_mock.ExitException, testjob.parse)
self.god.unmock_io()
+ self.god.check_playback()
class job_stat_unittest(job_unittest):
@@ -711,9 +715,11 @@ class job_create_unittest(cli_mock.cli_unittest):
testjob = job.job_create()
sys.argv = ['atest', 'job', 'create', '--ignore_site_file']
self.god.mock_io()
- sys.exit.expect_call(1).and_raises(cli_mock.ExitException)
+ (sys.exit.expect_call(mock.anything_comparator())
+ .and_raises(cli_mock.ExitException))
self.assertRaises(cli_mock.ExitException, testjob.parse)
self.god.unmock_io()
+ self.god.check_playback()
def test_execute_create_job_no_hosts(self):
@@ -721,9 +727,11 @@ class job_create_unittest(cli_mock.cli_unittest):
filename = cli_mock.create_file(self.ctrl_file)
sys.argv = ['atest', '-f', filename, 'test_job0', '--ignore_site_file']
self.god.mock_io()
- sys.exit.expect_call(1).and_raises(cli_mock.ExitException)
+ (sys.exit.expect_call(mock.anything_comparator())
+ .and_raises(cli_mock.ExitException))
self.assertRaises(cli_mock.ExitException, testjob.parse)
self.god.unmock_io()
+ self.god.check_playback()
def test_execute_create_job_cfile_and_tests(self):
@@ -732,9 +740,11 @@ class job_create_unittest(cli_mock.cli_unittest):
'control_file', 'test_job0', '-m', 'host0',
'--ignore_site_file']
self.god.mock_io()
- sys.exit.expect_call(1).and_raises(cli_mock.ExitException)
+ (sys.exit.expect_call(mock.anything_comparator())
+ .and_raises(cli_mock.ExitException))
self.assertRaises(cli_mock.ExitException, testjob.parse)
self.god.unmock_io()
+ self.god.check_playback()
def test_execute_create_job_cfile_and_kernel(self):
@@ -742,9 +752,11 @@ class job_create_unittest(cli_mock.cli_unittest):
sys.argv = ['atest', 'job', 'create', '-f', 'control_file', '-k',
'kernel', 'test_job0', '-m', 'host0', '--ignore_site_file']
self.god.mock_io()
- sys.exit.expect_call(1).and_raises(cli_mock.ExitException)
+ (sys.exit.expect_call(mock.anything_comparator())
+ .and_raises(cli_mock.ExitException))
self.assertRaises(cli_mock.ExitException, testjob.parse)
self.god.unmock_io()
+ self.god.check_playback()
def test_execute_create_job_bad_cfile(self):
@@ -752,7 +764,8 @@ class job_create_unittest(cli_mock.cli_unittest):
sys.argv = ['atest', 'job', 'create', '-f', 'control_file',
'test_job0', '-m', 'host0', '--ignore_site_file']
self.god.mock_io()
- sys.exit.expect_call(1).and_raises(IOError)
+ (sys.exit.expect_call(mock.anything_comparator())
+ .and_raises(IOError))
self.assertRaises(IOError, testjob.parse)
self.god.unmock_io()
@@ -762,9 +775,11 @@ class job_create_unittest(cli_mock.cli_unittest):
sys.argv = ['atest', 'job', 'create', '-t', 'sleeptest', '-p', 'Uber',
'-m', 'host0', 'test_job0', '--ignore_site_file']
self.god.mock_io()
- sys.exit.expect_call(2).and_raises(cli_mock.ExitException)
+ (sys.exit.expect_call(mock.anything_comparator())
+ .and_raises(cli_mock.ExitException))
self.assertRaises(cli_mock.ExitException, testjob.parse)
self.god.unmock_io()
+ self.god.check_playback()
def test_execute_create_job_with_mfile(self):