mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-26 15:57:16 +00:00
chg: [tests API] use argv api key
This commit is contained in:
parent
2ec96586eb
commit
9a0f7894a0
1 changed files with 12 additions and 7 deletions
|
@ -23,12 +23,17 @@ def parse_response(obj, ail_response):
|
||||||
return res_json
|
return res_json
|
||||||
|
|
||||||
def get_api_key():
|
def get_api_key():
|
||||||
with open(os.path.join(os.environ['AIL_HOME'], 'DEFAULT_PASSWORD'), 'r') as f:
|
api_file = os.path.join(os.environ['AIL_HOME'], 'DEFAULT_PASSWORD')
|
||||||
content = f.read()
|
if os.path.isfile(api_file):
|
||||||
content = content.splitlines()
|
with open(os.path.join(os.environ['AIL_HOME'], 'DEFAULT_PASSWORD'), 'r') as f:
|
||||||
apikey = content[-1]
|
content = f.read()
|
||||||
apikey = apikey.replace('API_Key=', '', 1)
|
content = content.splitlines()
|
||||||
return apikey
|
apikey = content[-1]
|
||||||
|
apikey = apikey.replace('API_Key=', '', 1)
|
||||||
|
# manual tests
|
||||||
|
else:
|
||||||
|
apikey = sys.argv[1]
|
||||||
|
return apikey
|
||||||
|
|
||||||
APIKEY = get_api_key()
|
APIKEY = get_api_key()
|
||||||
|
|
||||||
|
@ -162,4 +167,4 @@ class TestApiV1(unittest.TestCase):
|
||||||
self.assertTrue(req_json['tags'])
|
self.assertTrue(req_json['tags'])
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main(argv=['first-arg-is-ignored'], exit=False)
|
||||||
|
|
Loading…
Reference in a new issue