From f8c6b6b08acbfbf3b10f0ba4421129c78aded250 Mon Sep 17 00:00:00 2001 From: asteroide Date: Tue, 25 Apr 2017 11:06:39 +0200 Subject: Connect to Keystone with an unscoped token instead of a scoped one. Change-Id: I22c8077d911d03f1f14b1ef832a9b61dc5ac37df --- moonv4/moon_interface/tests/apitests/utils/pdp.py | 28 +++++++++++++---------- 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'moonv4') 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"] - -- cgit 1.2.3-korg