def setUp(self): self.args = mock.Mock(spec=argparse.Namespace) self.yaml = os.path.join(os.path.dirname(os.path.dirname(__file__)), "data/test_yaml.yaml") self.base_object = Base(app=mock.Mock(), app_args=self.args) self.yaml_file = self.base_object.load_yaml(self.yaml)
class TestBase(unittest.TestCase): """Unit tests for Base""" description_value = None def setUp(self): self.args = mock.Mock(spec=argparse.Namespace) self.yaml_file = os.path.join(os.path.dirname(__file__), "data/test_yaml.yaml") self.test_object = Base(app=mock.Mock(), app_args=self.args) def test_get_parser(self): parser = self.test_object.get_parser('NAME') self.assertEqual('NAME', parser.prog) def test_load_yaml(self): file = self.test_object.load_yaml(self.yaml_file) self.assertIn("Execute", file)
class TestOptions(unittest.TestCase): """Unit tests for Options""" def setUp(self): self.args = mock.Mock(spec=argparse.Namespace) self.yaml = os.path.join(os.path.dirname(os.path.dirname(__file__)), "data/test_yaml.yaml") self.base_object = Base(app=mock.Mock(), app_args=self.args) self.yaml_file = self.base_object.load_yaml(self.yaml) def test__init(self): self.test_object = Options(self.yaml_file["Options"]) self.assertEqual("myTestProject", self.test_object.project_name)
class TestEnvironment(unittest.TestCase): """Unit tests for Environment""" def setUp(self): self.args = mock.Mock(spec=argparse.Namespace) self.yaml = os.path.join(os.path.dirname(os.path.dirname(__file__)), "data/test_yaml.yaml") self.base_object = Base(app=mock.Mock(), app_args=self.args) self.yaml_file = self.base_object.load_yaml(self.yaml) def test__init(self): self.test_object = Environment(self.yaml_file["Environment"]) self.assertEqual("v2", self.test_object.OS_API_VERSION)
class TestFramework(unittest.TestCase): """Unit tests for Framework""" def setUp(self): self.args = mock.Mock(spec=argparse.Namespace) self.yaml = os.path.join(os.path.dirname(os.path.dirname(__file__)), "data/test_yaml.yaml") self.base_object = Base(app=mock.Mock(), app_args=self.args) self.yaml_file = self.base_object.load_yaml(self.yaml) def test__init(self): self.test_object = Framework(self.yaml_file["Execute"]["framework_1"], "framework_1") self.assertEqual("framework_1", self.test_object.name)
class TestOptionsExtractor(unittest.TestCase): """Unit tests for OptionsExtractor""" description_value = None def setUp(self): self.args = mock.Mock(spec=argparse.Namespace) self.yaml = os.path.join(os.path.dirname(os.path.dirname(__file__)), "data/test_yaml.yaml") self.base_object = Base(app=mock.Mock(), app_args=self.args) self.yaml_file = self.base_object.load_yaml(self.yaml) self.test_object = OptionsExtractor() def test_parse_framework(self): self.options = self.test_object.parse_options(self.yaml_file) self.assertEqual("myTestProject", self.options.project_name)
class TestEnvironmentExtractor(unittest.TestCase): """Unit tests for EnvironmentExtractor""" description_value = None def setUp(self): self.args = mock.Mock(spec=argparse.Namespace) self.yaml = os.path.join(os.path.dirname(os.path.dirname(__file__)), "data/test_yaml.yaml") self.base_object = Base(app=mock.Mock(), app_args=self.args) self.yaml_file = self.base_object.load_yaml(self.yaml) self.test_object = EnvironmentExtractor() def test_parse_framework(self): self.environment = self.test_object.parse_environment(self.yaml_file) self.assertEqual("v2", self.environment.OS_API_VERSION)
class TestFrameworkExtractor(unittest.TestCase): """Unit tests for FrameworkExtractor""" description_value = None def setUp(self): self.args = mock.Mock(spec=argparse.Namespace) self.yaml = os.path.join(os.path.dirname(os.path.dirname(__file__)), "data/test_yaml.yaml") self.base_object = Base(app=mock.Mock(), app_args=self.args) self.yaml_file = self.base_object.load_yaml(self.yaml) self.test_object = FrameworkExtractor() def test_parse_frameworks(self): self.framework_dict = self.test_object.parse_frameworks(self.yaml_file) self.assertIn("framework_1", self.framework_dict) self.assertIn("framework_2", self.framework_dict)