Exemplo n.º 1
0
 def test_apikey(self):
     expected_apikey = resolve_apikey()
     username = os.environ.get('MONITIS_USER')
     password = os.environ.get('MONITIS_PASS')
     returned_apikey = monitis.user.apikey(username=username,
                                           password=password)
     assert_equal(expected_apikey, returned_apikey)
Exemplo n.º 2
0
def secretkey(apikey=None):
    ''' The secret key associated with the given API key '''

    if apikey is None:
        apikey = resolve_apikey()

    return get(action='secretkey', apikey=apikey)['secretkey']
Exemplo n.º 3
0
def secretkey(apikey=None):
    ''' The secret key associated with the given API key '''

    if apikey is None:
        apikey = resolve_apikey()

    return get(action='secretkey', apikey=apikey)['secretkey']
Exemplo n.º 4
0
def auth_token(apikey=None, secretkey=None):
    ''' Generate an auth token

    If the apikey and/or secretkey are not specified as parameters,
    then they will be resolved, if possible.
    '''

    if apikey is None:
        apikey = resolve_apikey()

    if secretkey is None:
        secretkey = resolve_secretkey()

    return get(action='authToken', apikey=apikey,
               secretkey=secretkey)['authToken']
Exemplo n.º 5
0
def auth_token(apikey=None, secretkey=None):
    ''' Generate an auth token

    If the apikey and/or secretkey are not specified as parameters,
    then they will be resolved, if possible.
    '''

    if apikey is None:
        apikey = resolve_apikey()

    if secretkey is None:
        secretkey = resolve_secretkey()

    return get(action='authToken', apikey=apikey,
               secretkey=secretkey)['authToken']
Exemplo n.º 6
0
 def test_secretkey(self):
     apikey = resolve_apikey()
     expected_secretkey = resolve_secretkey()
     returned_secretkey = monitis.user.secretkey()
     assert_equal(expected_secretkey, returned_secretkey)
Exemplo n.º 7
0
 def test_resolve_apikey(self):
     apikey = resolve_apikey()
     # apikey is a string of exactly 26 uppercase alphanumeric characters
     matched = match('^[0-9A-Z]{26}$', apikey)
     assert matched is not None
Exemplo n.º 8
0
 def test_resolve_apikey(self):
     apikey = resolve_apikey()
     # apikey is a string of exactly 26 uppercase alphanumeric characters
     matched = match('^[0-9A-Z]{26}$', apikey)
     assert matched is not None