diff options
Diffstat (limited to 'moonv4/moon_interface/tests/apitests')
-rw-r--r-- | moonv4/moon_interface/tests/apitests/utils/pdp.py | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/moonv4/moon_interface/tests/apitests/utils/pdp.py b/moonv4/moon_interface/tests/apitests/utils/pdp.py index c4a1b756..7b6287b9 100644 --- a/moonv4/moon_interface/tests/apitests/utils/pdp.py +++ b/moonv4/moon_interface/tests/apitests/utils/pdp.py @@ -33,31 +33,36 @@ def get_keystone_projects(): ], "password": { "user": { + "name": KEYSTONE_USER, "domain": { - "id": "Default" + "name": "Default" }, - "name": KEYSTONE_USER, "password": KEYSTONE_PASSWORD } } - }, - "scope": { - "project": { - "domain": { - "id": "Default" - }, - "name": KEYSTONE_PROJECT - } } } } req = requests.post("{}/auth/tokens".format(KEYSTONE_SERVER), json=data_auth, headers=HEADERS) - assert req.status_code in (200, 201) TOKEN = req.headers['X-Subject-Token'] HEADERS['X-Auth-Token'] = TOKEN req = requests.get("{}/projects".format(KEYSTONE_SERVER), headers=HEADERS) + if req.status_code not in (200, 201): + data_auth["auth"]["scope"] = { + "project": { + "name": KEYSTONE_PROJECT, + "domain": { + "id": "Default" + } + } + } + req = requests.post("{}/auth/tokens".format(KEYSTONE_SERVER), json=data_auth, headers=HEADERS) + assert req.status_code in (200, 201) + TOKEN = req.headers['X-Subject-Token'] + HEADERS['X-Auth-Token'] = TOKEN + req = requests.get("{}/projects".format(KEYSTONE_SERVER), headers=HEADERS) assert req.status_code in (200, 201) return req.json() @@ -146,4 +151,3 @@ def delete_pdp(pdp_id): assert "result" in result assert result["result"] - |