import requests


def safebreach_test_module(url: str, api_key: str) -> str:
    """A simple test module
       Arguments:
           url {String} -- SafeBreach Management URL.
       Returns:
           str -- "ok" if succeeded, else raises a error.
       """
    full_url = url + '/api/orch/v1/status'
    response = requests.request(
        'GET',
        full_url,
        headers={'Accept': 'application/json', 'x-apitoken': api_key}
    )
    if response.status_code == 201:
        return 'ok'
    elif response.status_code == 401:
        return 'API Key is invalid, try again'
    elif response.status_code == 200:
        return 'URL is invalid, try again'
    elif response.status_code < 200 or response.status_code >= 300:
        return ('Test connection failed')
    return 'ok'