Add a new user for federation test. 65/21765/1
authorThomas Duval <thomas.duval@orange.com>
Thu, 8 Sep 2016 09:24:00 +0000 (11:24 +0200)
committerThomas Duval <thomas.duval@orange.com>
Tue, 20 Sep 2016 08:38:38 +0000 (10:38 +0200)
Change-Id: I76c620d853179800da548767c3a8484dd2e7d141
(cherry picked from commit 184ea3d6f75f6adbee63668f633f856989bd2bbc)

tests/run_tests.py

index 9b0c127..eb914a4 100755 (executable)
@@ -60,9 +60,17 @@ def __get_endpoint_url(name="keystone"):
 
 
 def test_federation():
+
+    username = "test_fede"
+    password = "pass_fede"
+
+    # Create a new user in OpenStack
+    proc = subprocess.Popen(["openstack", "user", "create", "--password", password, username, "-f", "yaml"], stdout=subprocess.PIPE)
+    logger.info("Create new user ({})".format(proc.stdout.read()))
+
     # Retrieve Moon token
     nhost, nport = __get_endpoint_url()
-    auth_data = {'username': 'admin', 'password': 'console'}
+    auth_data = {'username': username, 'password': password}
     conn = client.HTTPConnection(nhost, nport)
     headers = {"Content-type": "application/json"}
     conn.request("POST", "/moon/auth/tokens", json.dumps(auth_data).encode('utf-8'), headers=headers)