aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Duval <thomas.duval@orange.com>2016-09-09 15:00:37 +0200
committerThomas Duval <thomas.duval@orange.com>2016-09-20 10:38:38 +0200
commit4fc038ee9c0a633a0c505d750818698331c19c69 (patch)
treefbb714f8be11ea16229d93bf6b075e61b44c2b0b
parent2a451550630dcef4ffe02610440892b60ac2f38f (diff)
Udate the basic auth for the federation test and move some moonclient tests.
Change-Id: I8ee356a79d642fe3e6911a29315cbbde9a5fc34a (cherry picked from commit 09f675366af24386f77f556b31a3e8fa2a6397dd)
-rw-r--r--moonclient/moonclient/tests/todo/tests_empty_policy_new_user.json (renamed from moonclient/moonclient/tests/tests_empty_policy_new_user.json)0
-rw-r--r--moonclient/moonclient/tests/todo/tests_empty_policy_nova.json (renamed from moonclient/moonclient/tests/tests_empty_policy_nova.json)0
-rw-r--r--moonclient/moonclient/tests/todo/tests_empty_policy_swift.json (renamed from moonclient/moonclient/tests/tests_empty_policy_swift.json)0
-rw-r--r--moonclient/moonclient/tests/todo/tests_external_commands.json (renamed from moonclient/moonclient/tests/tests_external_commands.json)0
-rwxr-xr-xtests/run_tests.py40
5 files changed, 20 insertions, 20 deletions
diff --git a/moonclient/moonclient/tests/tests_empty_policy_new_user.json b/moonclient/moonclient/tests/todo/tests_empty_policy_new_user.json
index ad9d7e52..ad9d7e52 100644
--- a/moonclient/moonclient/tests/tests_empty_policy_new_user.json
+++ b/moonclient/moonclient/tests/todo/tests_empty_policy_new_user.json
diff --git a/moonclient/moonclient/tests/tests_empty_policy_nova.json b/moonclient/moonclient/tests/todo/tests_empty_policy_nova.json
index 399710be..399710be 100644
--- a/moonclient/moonclient/tests/tests_empty_policy_nova.json
+++ b/moonclient/moonclient/tests/todo/tests_empty_policy_nova.json
diff --git a/moonclient/moonclient/tests/tests_empty_policy_swift.json b/moonclient/moonclient/tests/todo/tests_empty_policy_swift.json
index e935da98..e935da98 100644
--- a/moonclient/moonclient/tests/tests_empty_policy_swift.json
+++ b/moonclient/moonclient/tests/todo/tests_empty_policy_swift.json
diff --git a/moonclient/moonclient/tests/tests_external_commands.json b/moonclient/moonclient/tests/todo/tests_external_commands.json
index 4caa0df1..4caa0df1 100644
--- a/moonclient/moonclient/tests/tests_external_commands.json
+++ b/moonclient/moonclient/tests/todo/tests_external_commands.json
diff --git a/tests/run_tests.py b/tests/run_tests.py
index f4f6f542..80dce696 100755
--- a/tests/run_tests.py
+++ b/tests/run_tests.py
@@ -85,15 +85,15 @@ def test_federation():
auth_data = {'username': 'admin', 'password': 'console'}
# Get basic auth with curl
- proc = subprocess.Popen("curl -u {}:{} http://{}:{}/auth/v1/domains".format(
- auth_data["username"], auth_data["password"], nhost, nport),
- stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- _stdout = proc.stdout.read()
- _stderr = proc.stderr.read()
- if len(_stdout) > 0:
- _stdout_json = json.loads(_stdout)
- if _stdout_json['code'] not in (200, 201, 202, 204):
- return False, "Not able to retrieve ODL auth ({}).".format(_stdout)
+ # proc = subprocess.Popen("curl -u {}:{} http://{}:{}/auth/v1/domains".format(
+ # auth_data["username"], auth_data["password"], nhost, nport),
+ # stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ # _stdout = proc.stdout.read()
+ # _stderr = proc.stderr.read()
+ # if len(_stdout) > 0:
+ # _stdout_json = json.loads(_stdout)
+ # if _stdout_json['code'] not in (200, 201, 202, 204):
+ # return False, "Not able to retrieve ODL auth ({}).".format(_stdout)
# Retrieve token from ODL
# conn = client.HTTPConnection(nhost, "8181")
@@ -104,17 +104,17 @@ def test_federation():
# return False, "Not able to retrieve ODL token on {}:{} (error code: {}).".format(nhost, "8181", resp.status)
# Retrieve basic auth from ODL
- # auth_handler = HTTPBasicAuthHandler()
- # auth_handler.add_password(realm='Moon',
- # uri='http://{host}:{port}/auth/v1/domains'.format(host=HOST_ODL, port=PORT_ODL),
- # user='admin',
- # passwd='console')
- # opener = build_opener(auth_handler)
- # install_opener(opener)
- # url = urlopen('http://{host}:{port}/auth/v1/domains'.format(host=HOST_ODL, port=PORT_ODL))
- # code = url.getcode()
- # if code not in (200, 201, 202, 204):
- # return False, "Not able to retrieve ODL token (error code: {}).".format(code)
+ auth_handler = HTTPBasicAuthHandler()
+ auth_handler.add_password(realm='Moon',
+ uri='http://{host}:{port}/auth/v1/domains'.format(host=nhost, port=nport),
+ user=username,
+ passwd=password)
+ opener = build_opener(auth_handler)
+ install_opener(opener)
+ url = urlopen('http://{host}:{port}/auth/v1/domains'.format(host=nhost, port=nport))
+ code = url.getcode()
+ if code not in (200, 201, 202, 204):
+ return False, "Not able to authenticate to ODL (error code: {}).".format(code)
return True, ""