def test_run_single_testcase_json(self): testcase_file_path = os.path.join( os.getcwd(), 'test/data/simple_demo_auth_hardcode.json') testcases = utils.load_testcases(testcase_file_path) testcase = testcases[0]["test"] success, _ = self.test_runner.run_test(testcase) self.assertTrue(success)
def test_run_testcase_template_yaml(self): testcase_file_path = os.path.join( os.getcwd(), 'test/data/demo_template_separate.yml') testcases = utils.load_testcases(testcase_file_path) success, _ = self.test_runner.run_test(testcases[0]["test"]) self.assertTrue(success) success, _ = self.test_runner.run_test(testcases[1]["test"]) self.assertTrue(success)
def test_load_yaml_testcases(self): testcase_file_path = os.path.join(os.getcwd(), 'test/data/demo.yml') testcases = utils.load_testcases(testcase_file_path) self.assertEqual(len(testcases), 2) self.assertIn('name', testcases[0]) self.assertIn('request', testcases[0]) self.assertIn('response', testcases[0]) self.assertIn('url', testcases[0]['request']) self.assertIn('method', testcases[0]['request'])
def test_load_yaml_testcases(self): testcase_file_path = os.path.join(os.getcwd(), 'test/data/simple_demo_no_auth.yml') testcases = utils.load_testcases(testcase_file_path) self.assertEqual(len(testcases), 2) testcase = testcases[0]["test"] self.assertIn('name', testcase) self.assertIn('request', testcase) self.assertIn('url', testcase['request']) self.assertIn('method', testcase['request'])
def test_load_yaml_testcases(self): testcase_file_path = os.path.join( os.getcwd(), 'tests/data/demo_testset_hardcode.yml') testcases = utils.load_testcases(testcase_file_path) self.assertEqual(len(testcases), 3) testcase = testcases[0]["test"] self.assertIn('name', testcase) self.assertIn('request', testcase) self.assertIn('url', testcase['request']) self.assertIn('method', testcase['request'])
def test_run_single_testcase(self): for testcase_file_path in self.testcase_file_path_list: testcases = utils.load_testcases(testcase_file_path) testcase = testcases[0]["test"] self.assertTrue(self.test_runner.run_test(testcase)) testcase = testcases[1]["test"] self.assertTrue(self.test_runner.run_test(testcase)) testcase = testcases[2]["test"] self.assertTrue(self.test_runner.run_test(testcase))
def setUp(self): self.context = Context() testcase_file_path = os.path.join(os.getcwd(), 'tests/data/demo_binds.yml') self.testcases = utils.load_testcases(testcase_file_path)
def test_load_testcases_bad_filepath(self): testcase_file_path = os.path.join(os.getcwd(), 'test/data/demo') with self.assertRaises(exception.ParamsError): utils.load_testcases(testcase_file_path)
def test_run_testcase_suite_yaml_success(self): testcase_file_path = os.path.join(os.getcwd(), 'test/data/demo.yml') testcases = utils.load_testcases(testcase_file_path) result = self.test_runner.run_testcase_suite(testcases) self.assertEqual(len(result), 2) self.assertEqual(result, [(True, {}), (True, {})])
def test_run_single_testcase_success(self): testcase_file_path = os.path.join(os.getcwd(), 'test/data/demo.json') testcases = utils.load_testcases(testcase_file_path) success, _ = self.test_runner.run_single_testcase(testcases[0]) self.assertTrue(success)
def test_load_testcases_bad_filepath(self): testcase_file_path = os.path.join(os.getcwd(), 'tests/data/demo') self.assertEqual(utils.load_testcases(testcase_file_path), [])