How to use the mkmsdk.api_map._API_MAP 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_integration / test_api.py View on Github external
def test_good_request():
    """Verifies that a correctly formed api request returns 200."""
    new_api = Api(_API_MAP["1.1"]["api_sandbox_root"])
    response = new_api.request("/games", "get")

    assert response.status_code == 200
github evonove / mkm-sdk / tests / tests_unit / test_resolvers.py View on Github external
def test_if_bad_parameters_are_handled_correctly():
    """Verifies exception is thrown when user passes an unexisting parameter."""
    live_resolver = SimpleResolver(_API_MAP["1.1"]["api_root"])
    simple_api_map_with_parameters = {"url": "/user/{user}", "method": "get"}

    with pytest.raises(exceptions.MissingParam):
        live_resolver.setup(simple_api_map_with_parameters)

    with pytest.raises(exceptions.MissingParam):
        live_resolver.setup(simple_api_map_with_parameters, bad_param="Worst parameter ever")
github evonove / mkm-sdk / tests / tests_integration / test_resolvers.py View on Github external
def test_resolve_with_data():
    """
    Verifies calling resolve with some data serializes it
    correctly if necessary before sending it to the backend
    so that it returns a positive response
    """
    resolver = SimpleResolver(_API_MAP["1.1"]["api_sandbox_root"])

    simple_api_map = {"url": "/stock", "method": "post"}

    # Data posted to MKM, this will be serialized to XML
    # before being sent, otherwise the backend won't accept it
    data = {
        "article": [
            {
                "idProduct": 100569,
                "idLanguage": 1,
                "comments": "Inserted through the API",
                "count": 1,
                "price": 4,
                "condition": "EX",
                "isFoil": True,
                "isSigned": False,