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']
def test_secretkey(self): apikey = resolve_apikey() expected_secretkey = resolve_secretkey() returned_secretkey = monitis.user.secretkey() assert_equal(expected_secretkey, returned_secretkey)
def test_get(self): # this test needs a simple API call, secretkey fits the bill # http://www.monitis.com/api?action=secretkey&apikey=${MONITIS_APIKEY} secret_key = get(action='secretkey')['secretkey'] assert_equals(secret_key,resolve_secretkey())
def test_resolve_secretkey(self): secretkey = resolve_secretkey() matched = match('^[0-9A-Z]{26}$', secretkey) assert matched is not None
def test_get(self): # this test needs a simple API call, secretkey fits the bill # http://www.monitis.com/api?action=secretkey&apikey=${MONITIS_APIKEY} secret_key = get(action='secretkey')['secretkey'] assert_equals(secret_key, resolve_secretkey())