From fc772d73549d9a99188cf0534eba7d2f1e0a52d7 Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Thu, 19 Jun 2014 14:11:56 -0400 Subject: [PATCH] Add a couple tests for teuthology.schedule Signed-off-by: Zack Cerza --- teuthology/test/test_schedule.py | 43 ++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 teuthology/test/test_schedule.py diff --git a/teuthology/test/test_schedule.py b/teuthology/test/test_schedule.py new file mode 100644 index 0000000000..fef0d4e019 --- /dev/null +++ b/teuthology/test/test_schedule.py @@ -0,0 +1,43 @@ +from ..schedule import build_config +from ..misc import get_user + + +class TestSchedule(object): + basic_args = { + '--verbose': False, + '--owner': 'OWNER', + '--description': 'DESC', + '--email': 'EMAIL', + '--last-in-suite': True, + '--name': 'NAME', + '--worker': 'tala', + '--timeout': '6', + '--priority': '99', + # TODO: make this work regardless of $PWD + #'': ['../../examples/3node_ceph.yaml', + # '../../examples/3node_rgw.yaml'], + } + + def test_basic(self): + expected = { + 'description': 'DESC', + 'email': 'EMAIL', + 'last_in_suite': True, + 'machine_type': 'tala', + 'name': 'NAME', + 'owner': 'OWNER', + 'priority': 99, + 'results_timeout': '6', + 'verbose': False, + 'tube': 'tala', + } + + job_dict = build_config(self.basic_args) + assert job_dict == expected + + def test_owner(self): + args = self.basic_args + args['--owner'] = None + job_dict = build_config(self.basic_args) + assert job_dict['owner'] == 'scheduled_%s' % get_user() + -- 2.39.5