Ejemplo n.º 1
0
    def generate_test_function(json_file):
        json_data = load_json_data(json_file)

        setting = TestSetting(json_data, Options())

        builder = MultipleTargetsTestFunctionBuilder(setting)
        return builder.build()
Ejemplo n.º 2
0
    def test_single(self):
        json_file = '%s/resources/test_function_init_single.json' % self.current_dir_path
        json_data = load_json_data(json_file)

        setting = TestSetting(json_data, Options())

        builder = TestFunctionBuilderFactory.get_builder(setting)
        self.assertTrue(isinstance(builder, SingleTargetTestFunctionBuilder))
Ejemplo n.º 3
0
    def test_target(self):
        json_file = '%s/resources/test_target.json' % self.current_dir_path
        json_data = load_json_data(json_file)

        test_target = TestTarget(json_data, Options())

        self.assertEqual(json_data[TestTarget.KEY_API],
                         convert_api_to_dict(test_target.api))
        self.assertEqual(json_data[TestTarget.KEY_TESTS],
                         convert_tests_to_dict(test_target.tests))
Ejemplo n.º 4
0
    def test_single(self):
        json_file = '%s/resources/test_setting_single.json' % self.current_dir_path
        json_data = load_json_data(json_file)

        setting = TestSetting(json_data, Options())

        self.assertFalse(setting.has_multiple_targets())

        self.assertEqual(json_data[TestTarget.KEY_API],
                         convert_api_to_dict(setting.targets[0].api))
        self.assertEqual(json_data[TestTarget.KEY_TESTS],
                         convert_tests_to_dict(setting.targets[0].tests))
Ejemplo n.º 5
0
    def test_multiple(self):
        json_file = '%s/resources/test_setting_multiple.json' % self.current_dir_path
        json_data = load_json_data(json_file)

        setting = TestSetting(json_data, Options())

        self.assertTrue(setting.has_multiple_targets())

        for idx, target in enumerate(setting.targets):
            self.assertEqual(json_data[idx][TestTarget.KEY_API],
                             convert_api_to_dict(target.api))
            self.assertEqual(json_data[idx][TestTarget.KEY_TESTS],
                             convert_tests_to_dict(target.tests))
Ejemplo n.º 6
0
    def test_target_missing_response(self):
        json_file = '%s/resources/test_target_missing_response.json' % self.current_dir_path
        json_data = load_json_data(json_file)

        with self.assertRaises(IncompleteTargetInformationError):
            TestTarget(json_data, Options())