How to use the mkmsdk.exceptions.MissingEnvVar function in mkmsdk

To help you get started, we’ve selected a few mkmsdk 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 evonove / mkm-sdk / tests / tests_unit / test_api.py View on Github external
def test_missing_env_var_raise_exception_correctly(mocker):
    """Verifies that an expection is thrown when necessary env vars are missing."""
    os_mocked = mocker.patch("mkmsdk.utils.os")
    os_mocked.environ = {}
    with pytest.raises(exceptions.MissingEnvVar):
        get_mkm_app_secret()
github evonove / mkm-sdk / tests / tests_unit / test_exception.py View on Github external
def test_missing_config():
    """Test error string is formatted correctly"""
    error = MissingEnvVar("client_id")

    assert str(error) == "Missing client_id environment variable"
github evonove / mkm-sdk / mkmsdk / utils.py View on Github external
def _get_env_var(key):
    try:
        return os.environ[key]
    except KeyError:
        raise exceptions.MissingEnvVar(key)