From 40bf2719ec0cac8e74f5484d9efaf7e906e931cc Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Mon, 2 Nov 2015 13:18:26 -0700 Subject: [PATCH] suite: Fix updated unit test First, split half of test_schedule_suite into test_schedule_suite_noverify. Also reflect the fact that Mock doesn't provide a simple assert_called(). Signed-off-by: Zack Cerza --- teuthology/test/test_suite.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/teuthology/test/test_suite.py b/teuthology/test/test_suite.py index d6e9a253fc..c7888c3e2a 100644 --- a/teuthology/test/test_suite.py +++ b/teuthology/test/test_suite.py @@ -787,13 +787,20 @@ class TestSuiteMain(object): get_hash=DEFAULT, package_version_for_hash=lambda *args: 'fake-9.5', ) as m: - config.suite_verify_ceph_hash = False + config.suite_verify_ceph_hash = True + m['get_hash'].return_value = '12345' main(['--suite', suite_name, '--suite-dir', 'teuthology/test', '--throttle', throttle, '--machine-type', machine_type]) m['sleep'].assert_called_with(int(throttle)) - m['get_hash'].assert_not_called() + m['get_hash'].assert_called_with('ceph', 'master', 'basic', + machine_type, None) + + def test_schedule_suite_noverify(self): + suite_name = 'noop' + throttle = '3' + machine_type = 'burnupi' with patch.multiple( suite, @@ -805,11 +812,10 @@ class TestSuiteMain(object): get_hash=DEFAULT, package_version_for_hash=lambda *args: 'fake-9.5', ) as m: - config.suite_verify_ceph_hash = True - m['get_hash'].return_value = '12345' + config.suite_verify_ceph_hash = False main(['--suite', suite_name, '--suite-dir', 'teuthology/test', '--throttle', throttle, '--machine-type', machine_type]) m['sleep'].assert_called_with(int(throttle)) - m['get_hash'].assert_called() + m['get_hash'].assert_not_called() -- 2.39.5