diff options
author | asteroide <thomas.duval@orange.com> | 2017-04-25 11:06:39 +0200 |
---|---|---|
committer | asteroide <thomas.duval@orange.com> | 2017-04-25 11:31:40 +0200 |
commit | f8c6b6b08acbfbf3b10f0ba4421129c78aded250 (patch) | |
tree | ce4b088b09a2115430a0c3dabe867b1f085fe525 /moonv4/moon_interface | |
parent | 6a808c2a62fdec53eabf445356a5494c3654b894 (diff) |
Connect to Keystone with an unscoped token instead of a scoped one.
Change-Id: I22c8077d911d03f1f14b1ef832a9b61dc5ac37df
Diffstat (limited to 'moonv4/moon_interface')
-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"] - |