How to use the scanapi.config_loader.load_config_file function in scanapi

To help you get started, we’ve selected a few scanapi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github camilamaia / scanapi / tests / unit / test_config_loader.py View on Github external
def test_should_raise_exception(self):
            with pytest.raises(FileFormatNotSupportedError) as excinfo:
                load_config_file("tests/data/api_wrong_format_include.yaml")

            assert (
                str(excinfo.value)
                == "The format .txt is not supported. Supported formats: '.yaml', '.yml', '.json'. "
                "File path: 'tests/data/include.txt'."
github camilamaia / scanapi / tests / unit / test_config_loader.py View on Github external
def test_should_raise_exception(self):

            with pytest.raises(FileNotFoundError) as excinfo:
                load_config_file("tests/data/api_invalid_path_include.yaml")

            assert "[Errno 2] No such file or directory: " in str(excinfo.value)
            assert "tests/data/invalid_path/include.yaml'" in str(excinfo.value)
github camilamaia / scanapi / tests / unit / test_config_loader.py View on Github external
def test_should_load(self):
            data = load_config_file("tests/data/jsonfile.json")
            assert data == {
                "api": {
                    "endpoints": [
                        {
                            "name": "scanapi-demo",
                            "path": "${BASE_URL}",
                            "requests": [{"name": "health", "path": "/health/"}],
                        }
github camilamaia / scanapi / tests / unit / test_config_loader.py View on Github external
def test_should_raise_exception(self):
            with pytest.raises(FileFormatNotSupportedError) as excinfo:
                load_config_file("tests/data/not_supported_format.txt")

            assert (
                str(excinfo.value)
                == "The format .txt is not supported. Supported formats: '.yaml', '.yml', '.json'. "
                "File path: 'tests/data/not_supported_format.txt'."
github camilamaia / scanapi / tests / unit / test_config_loader.py View on Github external
def test_should_raise_exception(self):
            with pytest.raises(EmptyConfigFileError) as excinfo:
                load_config_file("tests/data/empty.yaml")

            assert str(excinfo.value) == "File 'tests/data/empty.yaml' is empty."
github camilamaia / scanapi / tests / unit / test_config_loader.py View on Github external
def test_should_load(self):
        data = load_config_file("tests/data/api.yaml")
        assert data == {
            "api": {
                "endpoints": [
                    {
                        "name": "scanapi-demo",
                        "path": "${BASE_URL}",
                        "requests": [{"name": "health", "path": "/health/"}],
                    }
github camilamaia / scanapi / scanapi / settings.py View on Github external
def save_config_file_preferences(self, config_path=None):
        if not config_path and not self.has_default_config_file:
            return

        if not config_path:
            user_config = load_config_file(DEFAULT_CONFIG_PATH)
            self["config_path"] = DEFAULT_CONFIG_PATH
            self.update(**user_config)
            return

        user_config = load_config_file(config_path)
        self.update(**user_config)
github camilamaia / scanapi / scanapi / settings.py View on Github external
def save_config_file_preferences(self, config_path=None):
        if not config_path and not self.has_default_config_file:
            return

        if not config_path:
            user_config = load_config_file(DEFAULT_CONFIG_PATH)
            self["config_path"] = DEFAULT_CONFIG_PATH
            self.update(**user_config)
            return

        user_config = load_config_file(config_path)
        self.update(**user_config)