Beispiel #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)
Beispiel #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']
Beispiel #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']
Beispiel #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']
Beispiel #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']
Beispiel #6
0
 def test_secretkey(self):
     apikey = resolve_apikey()
     expected_secretkey = resolve_secretkey()
     returned_secretkey = monitis.user.secretkey()
     assert_equal(expected_secretkey, returned_secretkey)
Beispiel #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
Beispiel #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