diff --git a/resources/keystone_user/test.py b/resources/keystone_user/test.py new file mode 100644 index 00000000..3fe8e8e2 --- /dev/null +++ b/resources/keystone_user/test.py @@ -0,0 +1,24 @@ +import json +import requests + + +def test(resource): + print 'Testing keystone_user {}'.format(resource.args['user_name'].value) + + token_data = requests.post( + 'http://%s:%s/v2.0/tokens' % (resource.args['keystone_host'].value, resource.args['keystone_port'].value), + json.dumps({ + 'auth': { + 'tenantName': resource.args['tenant_name'].value, + 'passwordCredentials': { + 'username': resource.args['user_name'].value, + 'password': resource.args['user_password'].value, + }, + }, + }), + headers={'Content-Type': 'application/json'} + ) + + token = token_data.json()['access']['token']['id'] + + print '{} TOKEN: {}'.format(resource.args['user_name'].value, token)