Merge "Added server details tests. Also re-added several files that somehow missed the initial commit"
diff --git a/README.rst b/README.rst
index c027b1a..f00ce6c 100644
--- a/README.rst
+++ b/README.rst
@@ -16,6 +16,7 @@
run_tests.sh --nova
run_tests.sh --glance
run_tests.sh --swift
+ run_tests.sh --auth
Additional Info
diff --git a/kong/common/http.py b/kong/common/http.py
index 47ac058..d7f4a48 100644
--- a/kong/common/http.py
+++ b/kong/common/http.py
@@ -14,7 +14,6 @@
self.base_url = "http://%s:%s/%s" % (host, port, base_url)
def poll_request(self, method, url, check_response, **kwargs):
-
timeout = kwargs.pop('timeout', 180)
interval = kwargs.pop('interval', 2)
# Start timestamp
@@ -29,15 +28,13 @@
time.sleep(interval)
def poll_request_status(self, method, url, status=200, **kwargs):
-
def check_response(resp, body):
return resp['status'] == str(status)
self.poll_request(method, url, check_response, **kwargs)
-
def request(self, method, url, **kwargs):
- # Default to management_url, but can be overridden here
+ # Default to management_url, but can be overridden here
# (for auth requests)
base_url = kwargs.get('base_url', self.management_url)
diff --git a/kong/nova.py b/kong/nova.py
index 41b4b4e..bb40d59 100644
--- a/kong/nova.py
+++ b/kong/nova.py
@@ -1,6 +1,4 @@
import json
-import logging
-import subprocess
import kong.common.http
from kong import exceptions
@@ -24,7 +22,7 @@
self.user = user
self.api_key = api_key
self.project_id = project_id
- # Default to same as base_url, but will be change on auth
+ # Default to same as base_url, but will be changed for auth
self.management_url = self.base_url
def authenticate(self, user, api_key, project_id):
@@ -104,7 +102,7 @@
project_id = kwargs.get('project_id', self.project_id)
headers['X-Auth-Token'] = self.authenticate(self.user, self.api_key,
- self.project_id)
+ project_id)
kwargs['headers'] = headers
return super(API, self).request(method, url, **kwargs)
diff --git a/kong/run_tests.py b/kong/run_tests.py
index 091dce4..57a8253 100644
--- a/kong/run_tests.py
+++ b/kong/run_tests.py
@@ -1,7 +1,6 @@
#!/usr/bin/env python
# vim: tabstop=4 shiftwidth=4 softtabstop=4
-import gettext
import heapq
import os
import unittest
diff --git a/kong/run_tests.sh b/kong/run_tests.sh
index 96c2406..f666fbd 100755
--- a/kong/run_tests.sh
+++ b/kong/run_tests.sh
@@ -8,9 +8,10 @@
echo " -N, --no-virtual-env Don't use virtualenv. Run tests in local environment"
echo " -f, --force Force a clean re-build of the virtual environment. Useful when dependencies have been added."
echo " -p, --pep8 Just run pep8"
- echo " --nova Run all tests tagged as \"nova\"."
- echo " --swift Run all tests tagged as \"swift\"."
- echo " --glance Run all tests tagged as \"glance\"."
+ echo " --nova Run all tests tagged as \"nova\"."
+ echo " --swift Run all tests tagged as \"swift\"."
+ echo " --glance Run all tests tagged as \"glance\"."
+ echo " --auth Run all tests tagged as \"auth\"."
echo " -h, --help Print this usage message"
echo ""
echo "Note: with no options specified, the script will try to run the tests in a virtual environment,"
@@ -29,6 +30,7 @@
--nova) noseargs="$noseargs -a tags=nova";;
--glance) noseargs="$noseargs -a tags=glance";;
--swift) noseargs="$noseargs -a tags=swift";;
+ --auth) noseargs="$noseargs -a tags=auth";;
*) noseargs="$noseargs $1"
esac
}
diff --git a/kong/tests/994_test_rabbitmq.py b/kong/tests/994_test_rabbitmq.py
index 0a10194..77d30a0 100644
--- a/kong/tests/994_test_rabbitmq.py
+++ b/kong/tests/994_test_rabbitmq.py
@@ -41,11 +41,10 @@
test_000_ghetto.tags = ['rabbitmq']
def _cnx(self):
- # TODO: Figuring out what's going with creds
- # creds = pika.credentials.PlainCredentials(
- # self.rabbitmq['user'], self.rabbitmq['pass']
+ creds = pika.credentials.PlainCredentials(
+ self.rabbitmq['user'], self.rabbitmq['pass'])
connection = pika.BlockingConnection(pika.ConnectionParameters(
- host=self.rabbitmq['host']))
+ host=self.rabbitmq['host'],credentials=creds))
channel = connection.channel()
return (channel, connection)
diff --git a/kong/tests/test_auth.py b/kong/tests/test_auth.py
index bc040a8..2e2546a 100644
--- a/kong/tests/test_auth.py
+++ b/kong/tests/test_auth.py
@@ -19,8 +19,6 @@
import httplib2
import json
-import os
-import time
import uuid
from kong import keystone
@@ -67,6 +65,10 @@
self.assertEqual(response.status, 200)
res_body = json.loads(content)
self.assertTrue(res_body['access']['token']['id'])
+ self.assertTrue(res_body['access']['token']['tenant']['id'],
+ self.tenant_id)
+ self.assertTrue(res_body['access']['user']['name'],
+ self.user)
test_can_get_token.tags = ['auth']
def test_bad_user(self):
diff --git a/kong/tests/test_images.py b/kong/tests/test_images.py
index 0a9b682..e0e22fa 100644
--- a/kong/tests/test_images.py
+++ b/kong/tests/test_images.py
@@ -89,7 +89,7 @@
def setUp(self):
super(TestGlanceAPI, self).setUp()
self.base_url = "http://%s:%s/%s/images" % (self.glance['host'],
- self.glance['port'],
+ self.glance['port'],
self.glance['apiver'])
def test_upload_ami_style_image(self):