From 31c73d036edc9bb9171c151855a68e70107bd60a Mon Sep 17 00:00:00 2001 From: debugtalk Date: Thu, 20 Jul 2017 11:18:09 +0800 Subject: [PATCH] rename test folder to tests --- {test => tests}/__init__.py | 0 {test => tests}/api_server.py | 0 {test => tests}/base.py | 2 +- {test => tests}/data/__init__.py | 0 {test => tests}/data/custom_functions.py | 0 {test => tests}/data/demo_binds.yml | 2 +- .../data/demo_import_functions.yml | 2 +- .../data/demo_template_separate.yml | 0 {test => tests}/data/demo_template_sets.yml | 0 .../data/simple_demo_auth_hardcode.json | 0 .../data/simple_demo_auth_hardcode.yml | 0 {test => tests}/data/simple_demo_no_auth.json | 0 {test => tests}/data/simple_demo_no_auth.yml | 0 {test => tests}/test_apiserver.py | 2 +- {test => tests}/test_apiserver_v2.py | 2 +- {test => tests}/test_client.py | 2 +- {test => tests}/test_context.py | 6 +-- {test => tests}/test_response.py | 2 +- {test => tests}/test_runner.py | 14 +++---- {test => tests}/test_runner_v2.py | 24 ++++++------ {test => tests}/test_task.py | 6 +-- {test => tests}/test_testcase.py | 0 {test => tests}/test_utils.py | 38 +++++++++---------- 23 files changed, 51 insertions(+), 51 deletions(-) rename {test => tests}/__init__.py (100%) rename {test => tests}/api_server.py (100%) rename {test => tests}/base.py (97%) rename {test => tests}/data/__init__.py (100%) rename {test => tests}/data/custom_functions.py (100%) rename {test => tests}/data/demo_binds.yml (96%) rename {test => tests}/data/demo_import_functions.yml (97%) rename {test => tests}/data/demo_template_separate.yml (100%) rename {test => tests}/data/demo_template_sets.yml (100%) rename {test => tests}/data/simple_demo_auth_hardcode.json (100%) rename {test => tests}/data/simple_demo_auth_hardcode.yml (100%) rename {test => tests}/data/simple_demo_no_auth.json (100%) rename {test => tests}/data/simple_demo_no_auth.yml (100%) rename {test => tests}/test_apiserver.py (99%) rename {test => tests}/test_apiserver_v2.py (99%) rename {test => tests}/test_client.py (96%) rename {test => tests}/test_context.py (97%) rename {test => tests}/test_response.py (99%) rename {test => tests}/test_runner.py (85%) rename {test => tests}/test_runner_v2.py (83%) rename {test => tests}/test_task.py (78%) rename {test => tests}/test_testcase.py (100%) rename {test => tests}/test_utils.py (91%) diff --git a/test/__init__.py b/tests/__init__.py similarity index 100% rename from test/__init__.py rename to tests/__init__.py diff --git a/test/api_server.py b/tests/api_server.py similarity index 100% rename from test/api_server.py rename to tests/api_server.py diff --git a/test/base.py b/tests/base.py similarity index 97% rename from test/base.py rename to tests/base.py index 36be48df..a3fdc8e1 100644 --- a/test/base.py +++ b/tests/base.py @@ -3,7 +3,7 @@ import time import unittest from ate import utils -from test import api_server +from tests import api_server class ApiServerUnittest(unittest.TestCase): diff --git a/test/data/__init__.py b/tests/data/__init__.py similarity index 100% rename from test/data/__init__.py rename to tests/data/__init__.py diff --git a/test/data/custom_functions.py b/tests/data/custom_functions.py similarity index 100% rename from test/data/custom_functions.py rename to tests/data/custom_functions.py diff --git a/test/data/demo_binds.yml b/tests/data/demo_binds.yml similarity index 96% rename from test/data/demo_binds.yml rename to tests/data/demo_binds.yml index 3977f37a..180d9dae 100644 --- a/test/data/demo_binds.yml +++ b/tests/data/demo_binds.yml @@ -34,7 +34,7 @@ bind_lambda_functions_with_import: bind_module_functions: function_binds: import_module_functions: - - test.data.custom_functions + - tests.data.custom_functions variable_binds: - TOKEN: debugtalk - random: ${gen_random_string(5)} diff --git a/test/data/demo_import_functions.yml b/tests/data/demo_import_functions.yml similarity index 97% rename from test/data/demo_import_functions.yml rename to tests/data/demo_import_functions.yml index 25d2ea11..89a48889 100644 --- a/test/data/demo_import_functions.yml +++ b/tests/data/demo_import_functions.yml @@ -1,7 +1,7 @@ - config: name: "create user testsets." import_module_functions: - - test.data.custom_functions + - tests.data.custom_functions variable_binds: - TOKEN: debugtalk - json: {} diff --git a/test/data/demo_template_separate.yml b/tests/data/demo_template_separate.yml similarity index 100% rename from test/data/demo_template_separate.yml rename to tests/data/demo_template_separate.yml diff --git a/test/data/demo_template_sets.yml b/tests/data/demo_template_sets.yml similarity index 100% rename from test/data/demo_template_sets.yml rename to tests/data/demo_template_sets.yml diff --git a/test/data/simple_demo_auth_hardcode.json b/tests/data/simple_demo_auth_hardcode.json similarity index 100% rename from test/data/simple_demo_auth_hardcode.json rename to tests/data/simple_demo_auth_hardcode.json diff --git a/test/data/simple_demo_auth_hardcode.yml b/tests/data/simple_demo_auth_hardcode.yml similarity index 100% rename from test/data/simple_demo_auth_hardcode.yml rename to tests/data/simple_demo_auth_hardcode.yml diff --git a/test/data/simple_demo_no_auth.json b/tests/data/simple_demo_no_auth.json similarity index 100% rename from test/data/simple_demo_no_auth.json rename to tests/data/simple_demo_no_auth.json diff --git a/test/data/simple_demo_no_auth.yml b/tests/data/simple_demo_no_auth.yml similarity index 100% rename from test/data/simple_demo_no_auth.yml rename to tests/data/simple_demo_no_auth.yml diff --git a/test/test_apiserver.py b/tests/test_apiserver.py similarity index 99% rename from test/test_apiserver.py rename to tests/test_apiserver.py index 29694f30..6e0c59c3 100644 --- a/test/test_apiserver.py +++ b/tests/test_apiserver.py @@ -1,6 +1,6 @@ import requests import random -from test.base import ApiServerUnittest +from tests.base import ApiServerUnittest class TestApiServer(ApiServerUnittest): def setUp(self): diff --git a/test/test_apiserver_v2.py b/tests/test_apiserver_v2.py similarity index 99% rename from test/test_apiserver_v2.py rename to tests/test_apiserver_v2.py index c95ab935..50c42a04 100644 --- a/test/test_apiserver_v2.py +++ b/tests/test_apiserver_v2.py @@ -1,7 +1,7 @@ import random import requests -from test.base import ApiServerUnittest +from tests.base import ApiServerUnittest class TestApiServerV2(ApiServerUnittest): diff --git a/test/test_client.py b/tests/test_client.py similarity index 96% rename from test/test_client.py rename to tests/test_client.py index f5fa6b5a..a42d7239 100644 --- a/test/test_client.py +++ b/tests/test_client.py @@ -1,5 +1,5 @@ from ate.client import HttpSession -from test.base import ApiServerUnittest +from tests.base import ApiServerUnittest class TestHttpClient(ApiServerUnittest): def setUp(self): diff --git a/test/test_context.py b/tests/test_context.py similarity index 97% rename from test/test_context.py rename to tests/test_context.py index c091a8bc..414364a2 100644 --- a/test/test_context.py +++ b/tests/test_context.py @@ -9,7 +9,7 @@ class VariableBindsUnittest(unittest.TestCase): def setUp(self): self.context = Context() - testcase_file_path = os.path.join(os.getcwd(), 'test/data/demo_binds.yml') + testcase_file_path = os.path.join(os.getcwd(), 'tests/data/demo_binds.yml') self.testcases = utils.load_testcases(testcase_file_path) def test_context_register_variables(self): @@ -127,7 +127,7 @@ class VariableBindsUnittest(unittest.TestCase): def test_import_module_functions(self): testcase1 = { - "import_module_functions": ["test.data.custom_functions"], + "import_module_functions": ["tests.data.custom_functions"], "variable_binds": [ {"TOKEN": "debugtalk"}, {"random": "${gen_random_string(5)}"}, @@ -162,7 +162,7 @@ class VariableBindsUnittest(unittest.TestCase): def test_get_parsed_request(self): test_runner = runner.Runner() testcase = { - "import_module_functions": ["test.data.custom_functions"], + "import_module_functions": ["tests.data.custom_functions"], "variable_binds": [ {"TOKEN": "debugtalk"}, {"random": "${gen_random_string(5)}"}, diff --git a/test/test_response.py b/tests/test_response.py similarity index 99% rename from test/test_response.py rename to tests/test_response.py index cbeb01d6..01fde5d4 100644 --- a/test/test_response.py +++ b/tests/test_response.py @@ -1,6 +1,6 @@ import requests from ate import response, exception -from test.base import ApiServerUnittest +from tests.base import ApiServerUnittest class TestResponse(ApiServerUnittest): diff --git a/test/test_runner.py b/tests/test_runner.py similarity index 85% rename from test/test_runner.py rename to tests/test_runner.py index 1fd3f462..ab550668 100644 --- a/test/test_runner.py +++ b/tests/test_runner.py @@ -1,7 +1,7 @@ import os import requests from ate import runner, exception, utils -from test.base import ApiServerUnittest +from tests.base import ApiServerUnittest class TestRunner(ApiServerUnittest): @@ -14,14 +14,14 @@ class TestRunner(ApiServerUnittest): return requests.delete(url) def test_run_single_testcase_yaml_success(self): - testcase_file_path = os.path.join(os.getcwd(), 'test/data/simple_demo_no_auth.yml') + testcase_file_path = os.path.join(os.getcwd(), 'tests/data/simple_demo_no_auth.yml') testcases = utils.load_testcases(testcase_file_path) testcase = testcases[0]["test"] success, _ = self.test_runner.run_test(testcase) self.assertTrue(success) def test_run_single_testcase_json_success(self): - testcase_file_path = os.path.join(os.getcwd(), 'test/data/simple_demo_no_auth.json') + testcase_file_path = os.path.join(os.getcwd(), 'tests/data/simple_demo_no_auth.json') testcases = utils.load_testcases(testcase_file_path) testcase = testcases[0]["test"] success, _ = self.test_runner.run_test(testcase) @@ -69,28 +69,28 @@ class TestRunner(ApiServerUnittest): ) def test_run_testset_json_success(self): - testcase_file_path = os.path.join(os.getcwd(), 'test/data/simple_demo_no_auth.json') + testcase_file_path = os.path.join(os.getcwd(), 'tests/data/simple_demo_no_auth.json') testsets = utils.load_testcases_by_path(testcase_file_path) results = self.test_runner.run_testset(testsets[0]) self.assertEqual(len(results), 2) self.assertEqual(results, [(True, []), (True, [])]) def test_run_testsets_json_success(self): - testcase_file_path = os.path.join(os.getcwd(), 'test/data/simple_demo_no_auth.json') + testcase_file_path = os.path.join(os.getcwd(), 'tests/data/simple_demo_no_auth.json') testsets = utils.load_testcases_by_path(testcase_file_path) results = self.test_runner.run_testsets(testsets) self.assertEqual(len(results), 1) self.assertEqual(results[0], [(True, []), (True, [])]) def test_run_testset_yaml_success(self): - testcase_file_path = os.path.join(os.getcwd(), 'test/data/simple_demo_no_auth.yml') + testcase_file_path = os.path.join(os.getcwd(), 'tests/data/simple_demo_no_auth.yml') testsets = utils.load_testcases_by_path(testcase_file_path) results = self.test_runner.run_testset(testsets[0]) self.assertEqual(len(results), 2) self.assertEqual(results, [(True, []), (True, [])]) def test_run_testsets_yaml_success(self): - testcase_file_path = os.path.join(os.getcwd(), 'test/data/simple_demo_no_auth.yml') + testcase_file_path = os.path.join(os.getcwd(), 'tests/data/simple_demo_no_auth.yml') testsets = utils.load_testcases_by_path(testcase_file_path) results = self.test_runner.run_testsets(testsets) self.assertEqual(len(results), 1) diff --git a/test/test_runner_v2.py b/tests/test_runner_v2.py similarity index 83% rename from test/test_runner_v2.py rename to tests/test_runner_v2.py index 5dc64a9a..b7af1f0d 100644 --- a/test/test_runner_v2.py +++ b/tests/test_runner_v2.py @@ -1,7 +1,7 @@ import os import requests from ate import runner, exception, utils -from test.base import ApiServerUnittest +from tests.base import ApiServerUnittest class TestRunnerV2(ApiServerUnittest): @@ -17,7 +17,7 @@ class TestRunnerV2(ApiServerUnittest): def test_run_single_testcase_yaml(self): testcase_file_path = os.path.join( - os.getcwd(), 'test/data/simple_demo_auth_hardcode.yml') + os.getcwd(), 'tests/data/simple_demo_auth_hardcode.yml') testcases = utils.load_testcases(testcase_file_path) testcase = testcases[0]["test"] success, _ = self.test_runner.run_test(testcase) @@ -25,7 +25,7 @@ class TestRunnerV2(ApiServerUnittest): def test_run_single_testcase_json(self): testcase_file_path = os.path.join( - os.getcwd(), 'test/data/simple_demo_auth_hardcode.json') + os.getcwd(), 'tests/data/simple_demo_auth_hardcode.json') testcases = utils.load_testcases(testcase_file_path) testcase = testcases[0]["test"] success, _ = self.test_runner.run_test(testcase) @@ -33,7 +33,7 @@ class TestRunnerV2(ApiServerUnittest): def test_run_testset_auth_yaml(self): testcase_file_path = os.path.join( - os.getcwd(), 'test/data/simple_demo_auth_hardcode.yml') + os.getcwd(), 'tests/data/simple_demo_auth_hardcode.yml') testsets = utils.load_testcases_by_path(testcase_file_path) results = self.test_runner.run_testset(testsets[0]) self.assertEqual(len(results), 2) @@ -41,7 +41,7 @@ class TestRunnerV2(ApiServerUnittest): def test_run_testsets_auth_yaml(self): testcase_file_path = os.path.join( - os.getcwd(), 'test/data/simple_demo_auth_hardcode.yml') + os.getcwd(), 'tests/data/simple_demo_auth_hardcode.yml') testsets = utils.load_testcases_by_path(testcase_file_path) results = self.test_runner.run_testsets(testsets) self.assertEqual(len(results), 1) @@ -49,7 +49,7 @@ class TestRunnerV2(ApiServerUnittest): def test_run_testset_auth_json(self): testcase_file_path = os.path.join( - os.getcwd(), 'test/data/simple_demo_auth_hardcode.json') + os.getcwd(), 'tests/data/simple_demo_auth_hardcode.json') testsets = utils.load_testcases_by_path(testcase_file_path) results = self.test_runner.run_testset(testsets[0]) self.assertEqual(len(results), 2) @@ -57,7 +57,7 @@ class TestRunnerV2(ApiServerUnittest): def test_run_testsets_auth_json(self): testcase_file_path = os.path.join( - os.getcwd(), 'test/data/simple_demo_auth_hardcode.json') + os.getcwd(), 'tests/data/simple_demo_auth_hardcode.json') testsets = utils.load_testcases_by_path(testcase_file_path) results = self.test_runner.run_testsets(testsets) self.assertEqual(len(results), 1) @@ -65,7 +65,7 @@ class TestRunnerV2(ApiServerUnittest): def test_run_testcase_template_yaml(self): testcase_file_path = os.path.join( - os.getcwd(), 'test/data/demo_template_separate.yml') + os.getcwd(), 'tests/data/demo_template_separate.yml') testcases = utils.load_testcases(testcase_file_path) success, _ = self.test_runner.run_test(testcases[0]["test"]) self.assertTrue(success) @@ -74,7 +74,7 @@ class TestRunnerV2(ApiServerUnittest): def test_run_testset_template_yaml(self): testcase_file_path = os.path.join( - os.getcwd(), 'test/data/demo_template_sets.yml') + os.getcwd(), 'tests/data/demo_template_sets.yml') testsets = utils.load_testcases_by_path(testcase_file_path) results = self.test_runner.run_testset(testsets[0]) self.assertEqual(len(results), 2) @@ -82,7 +82,7 @@ class TestRunnerV2(ApiServerUnittest): def test_run_testsets_template_yaml(self): testcase_file_path = os.path.join( - os.getcwd(), 'test/data/demo_template_sets.yml') + os.getcwd(), 'tests/data/demo_template_sets.yml') testsets = utils.load_testcases_by_path(testcase_file_path) results = self.test_runner.run_testsets(testsets) self.assertEqual(len(results), 1) @@ -90,7 +90,7 @@ class TestRunnerV2(ApiServerUnittest): def test_run_testset_template_import_functions(self): testcase_file_path = os.path.join( - os.getcwd(), 'test/data/demo_import_functions.yml') + os.getcwd(), 'tests/data/demo_import_functions.yml') testsets = utils.load_testcases_by_path(testcase_file_path) results = self.test_runner.run_testset(testsets[0]) self.assertEqual(len(results), 2) @@ -98,7 +98,7 @@ class TestRunnerV2(ApiServerUnittest): def test_run_testsets_template_import_functions(self): testcase_file_path = os.path.join( - os.getcwd(), 'test/data/demo_import_functions.yml') + os.getcwd(), 'tests/data/demo_import_functions.yml') testsets = utils.load_testcases_by_path(testcase_file_path) results = self.test_runner.run_testsets(testsets) self.assertEqual(len(results), 1) diff --git a/test/test_task.py b/tests/test_task.py similarity index 78% rename from test/test_task.py rename to tests/test_task.py index 8e2e7b0e..624ebcd7 100644 --- a/test/test_task.py +++ b/tests/test_task.py @@ -1,7 +1,7 @@ import os import random import requests -from test.base import ApiServerUnittest +from tests.base import ApiServerUnittest from ate import task, utils class TestMain(ApiServerUnittest): @@ -14,7 +14,7 @@ class TestMain(ApiServerUnittest): return requests.delete(url) def test_create_suite(self): - testcase_file_path = os.path.join(os.getcwd(), 'test/data/simple_demo_no_auth.yml') + testcase_file_path = os.path.join(os.getcwd(), 'tests/data/simple_demo_no_auth.yml') testsets = utils.load_testcases_by_path(testcase_file_path) suite = task.create_suite(testsets[0]) self.assertEqual(suite.countTestCases(), 2) @@ -22,7 +22,7 @@ class TestMain(ApiServerUnittest): self.assertIsInstance(testcase, task.ApiTestCase) def test_create_task(self): - testcase_file_path = os.path.join(os.getcwd(), 'test/data/simple_demo_no_auth.yml') + testcase_file_path = os.path.join(os.getcwd(), 'tests/data/simple_demo_no_auth.yml') task_suite = task.create_task(testcase_file_path) self.assertEqual(task_suite.countTestCases(), 2) for suite in task_suite: diff --git a/test/test_testcase.py b/tests/test_testcase.py similarity index 100% rename from test/test_testcase.py rename to tests/test_testcase.py diff --git a/test/test_utils.py b/tests/test_utils.py similarity index 91% rename from test/test_utils.py rename to tests/test_utils.py index 44c89c1f..f327fa06 100644 --- a/test/test_utils.py +++ b/tests/test_utils.py @@ -1,18 +1,18 @@ import os from ate import utils from ate import exception -from test.base import ApiServerUnittest +from tests.base import ApiServerUnittest class TestUtils(ApiServerUnittest): def test_load_testcases_bad_filepath(self): - testcase_file_path = os.path.join(os.getcwd(), 'test/data/demo') + testcase_file_path = os.path.join(os.getcwd(), 'tests/data/demo') with self.assertRaises(exception.ParamsError): utils.load_testcases(testcase_file_path) def test_load_json_testcases(self): testcase_file_path = os.path.join( - os.getcwd(), 'test/data/simple_demo_no_auth.json') + os.getcwd(), 'tests/data/simple_demo_no_auth.json') testcases = utils.load_testcases(testcase_file_path) self.assertEqual(len(testcases), 2) testcase = testcases[0]["test"] @@ -23,7 +23,7 @@ class TestUtils(ApiServerUnittest): def test_load_yaml_testcases(self): testcase_file_path = os.path.join( - os.getcwd(), 'test/data/simple_demo_no_auth.yml') + os.getcwd(), 'tests/data/simple_demo_no_auth.yml') testcases = utils.load_testcases(testcase_file_path) self.assertEqual(len(testcases), 2) testcase = testcases[0]["test"] @@ -33,10 +33,10 @@ class TestUtils(ApiServerUnittest): self.assertIn('method', testcase['request']) def test_load_foler_files(self): - folder = os.path.join(os.getcwd(), 'test') + folder = os.path.join(os.getcwd(), 'tests') files = utils.load_foler_files(folder) - file1 = os.path.join(os.getcwd(), 'test', 'test_utils.py') - file2 = os.path.join(os.getcwd(), 'test', 'data', 'demo_binds.yml') + file1 = os.path.join(os.getcwd(), 'tests', 'test_utils.py') + file2 = os.path.join(os.getcwd(), 'tests', 'data', 'demo_binds.yml') self.assertIn(file1, files) self.assertIn(file2, files) @@ -45,14 +45,14 @@ class TestUtils(ApiServerUnittest): # absolute file path path = os.path.join( - os.getcwd(), 'test/data/simple_demo_no_auth.json') + os.getcwd(), 'tests/data/simple_demo_no_auth.json') testset_list = utils.load_testcases_by_path(path) self.assertEqual(len(testset_list), 1) self.assertEqual(len(testset_list[0]["testcases"]), 2) testsets_list.extend(testset_list) # relative file path - path = 'test/data/simple_demo_no_auth.yml' + path = 'tests/data/simple_demo_no_auth.yml' testset_list = utils.load_testcases_by_path(path) self.assertEqual(len(testset_list), 1) self.assertEqual(len(testset_list[0]["testcases"]), 2) @@ -60,8 +60,8 @@ class TestUtils(ApiServerUnittest): # list/set container with file(s) path = [ - os.path.join(os.getcwd(), 'test/data/simple_demo_no_auth.json'), - 'test/data/simple_demo_no_auth.yml' + os.path.join(os.getcwd(), 'tests/data/simple_demo_no_auth.json'), + 'tests/data/simple_demo_no_auth.yml' ] testset_list = utils.load_testcases_by_path(path) self.assertEqual(len(testset_list), 2) @@ -79,38 +79,38 @@ class TestUtils(ApiServerUnittest): def test_load_testcases_by_path_folder(self): # absolute folder path - path = os.path.join(os.getcwd(), 'test/data') + path = os.path.join(os.getcwd(), 'tests/data') testset_list_1 = utils.load_testcases_by_path(path) self.assertGreater(len(testset_list_1), 6) # relative folder path - path = 'test/data/' + path = 'tests/data/' testset_list_2 = utils.load_testcases_by_path(path) self.assertEqual(len(testset_list_1), len(testset_list_2)) # list/set container with file(s) path = [ - os.path.join(os.getcwd(), 'test/data'), - 'test/data/' + os.path.join(os.getcwd(), 'tests/data'), + 'tests/data/' ] testset_list_3 = utils.load_testcases_by_path(path) self.assertEqual(len(testset_list_3), 2 * len(testset_list_1)) def test_load_testcases_by_path_not_exist(self): # absolute folder path - path = os.path.join(os.getcwd(), 'test/data_not_exist') + path = os.path.join(os.getcwd(), 'tests/data_not_exist') testset_list_1 = utils.load_testcases_by_path(path) self.assertEqual(testset_list_1, []) # relative folder path - path = 'test/data_not_exist' + path = 'tests/data_not_exist' testset_list_2 = utils.load_testcases_by_path(path) self.assertEqual(testset_list_2, []) # list/set container with file(s) path = [ - os.path.join(os.getcwd(), 'test/data_not_exist'), - 'test/data_not_exist/' + os.path.join(os.getcwd(), 'tests/data_not_exist'), + 'tests/data_not_exist/' ] testset_list_3 = utils.load_testcases_by_path(path) self.assertEqual(testset_list_3, [])