summaryrefslogtreecommitdiff
path: root/glanceclient/tests/unit
diff options
context:
space:
mode:
authorCindy Pallares <cindy.pallaresq@gmail.com>2015-05-19 19:59:06 -0500
committerCindy Pallares <cindy.pallaresq@gmail.com>2015-06-17 10:56:37 -0500
commit997c12d3abfd9a571a4e8f0b022dfb1d27c62edb (patch)
tree5ab2346452416876492d076c33dbb1c29db9edc9 /glanceclient/tests/unit
parent71d852836474f59f10a7bb9883f6dcecc56e5675 (diff)
downloadpython-glanceclient-997c12d3abfd9a571a4e8f0b022dfb1d27c62edb.tar.gz
Import only modules and update tox.ini
As stated in the OpenStack Hacking Guidelines, it is prefered that only modules should be imported. Also updated tox.ini to ignore opestack/common among others. Change-Id: I2f0a603c31052eadee581c11880c0ec6bd392829
Diffstat (limited to 'glanceclient/tests/unit')
-rw-r--r--glanceclient/tests/unit/test_client.py12
-rw-r--r--glanceclient/tests/unit/test_ssl.py27
-rw-r--r--glanceclient/tests/unit/v2/test_schemas.py5
3 files changed, 23 insertions, 21 deletions
diff --git a/glanceclient/tests/unit/test_client.py b/glanceclient/tests/unit/test_client.py
index 62daaf5..fea7949 100644
--- a/glanceclient/tests/unit/test_client.py
+++ b/glanceclient/tests/unit/test_client.py
@@ -16,8 +16,8 @@
import testtools
from glanceclient import client
-from glanceclient.v1 import client as v1
-from glanceclient.v2 import client as v2
+from glanceclient import v1
+from glanceclient import v2
class ClientTest(testtools.TestCase):
@@ -28,19 +28,19 @@ class ClientTest(testtools.TestCase):
def test_endpoint(self):
gc = client.Client(1, "http://example.com")
self.assertEqual("http://example.com", gc.http_client.endpoint)
- self.assertIsInstance(gc, v1.Client)
+ self.assertIsInstance(gc, v1.client.Client)
def test_versioned_endpoint(self):
gc = client.Client(1, "http://example.com/v2")
self.assertEqual("http://example.com", gc.http_client.endpoint)
- self.assertIsInstance(gc, v1.Client)
+ self.assertIsInstance(gc, v1.client.Client)
def test_versioned_endpoint_no_version(self):
gc = client.Client(endpoint="http://example.com/v2")
self.assertEqual("http://example.com", gc.http_client.endpoint)
- self.assertIsInstance(gc, v2.Client)
+ self.assertIsInstance(gc, v2.client.Client)
def test_versioned_endpoint_with_minor_revision(self):
gc = client.Client(2.2, "http://example.com/v2.1")
self.assertEqual("http://example.com", gc.http_client.endpoint)
- self.assertIsInstance(gc, v2.Client)
+ self.assertIsInstance(gc, v2.client.Client)
diff --git a/glanceclient/tests/unit/test_ssl.py b/glanceclient/tests/unit/test_ssl.py
index 907b7bf..4056850 100644
--- a/glanceclient/tests/unit/test_ssl.py
+++ b/glanceclient/tests/unit/test_ssl.py
@@ -29,8 +29,9 @@ import threading
from glanceclient.common import http
from glanceclient.common import https
-from glanceclient import Client
from glanceclient import exc
+from glanceclient import v1
+from glanceclient import v2
if six.PY3 is True:
import socketserver
@@ -90,9 +91,9 @@ class TestHTTPSVerifyCert(testtools.TestCase):
url = 'https://0.0.0.0:%d' % port
try:
- client = Client('1', url,
- insecure=False,
- ssl_compression=True)
+ client = v1.client.Client(url,
+ insecure=False,
+ ssl_compression=True)
client.images.get('image123')
self.fail('No SSL exception raised')
except exc.CommunicationError as e:
@@ -107,9 +108,9 @@ class TestHTTPSVerifyCert(testtools.TestCase):
url = 'https://0.0.0.0:%d' % port
try:
- client = Client('1', url,
- insecure=False,
- ssl_compression=False)
+ client = v1.client.Client(url,
+ insecure=False,
+ ssl_compression=False)
client.images.get('image123')
self.fail('No SSL exception raised')
except SSL.Error as e:
@@ -124,9 +125,9 @@ class TestHTTPSVerifyCert(testtools.TestCase):
url = 'https://0.0.0.0:%d' % port
try:
- gc = Client('2', url,
- insecure=False,
- ssl_compression=True)
+ gc = v2.client.Client(url,
+ insecure=False,
+ ssl_compression=True)
gc.images.get('image123')
self.fail('No SSL exception raised')
except exc.CommunicationError as e:
@@ -141,9 +142,9 @@ class TestHTTPSVerifyCert(testtools.TestCase):
url = 'https://0.0.0.0:%d' % port
try:
- gc = Client('2', url,
- insecure=False,
- ssl_compression=False)
+ gc = v2.client.Client(url,
+ insecure=False,
+ ssl_compression=False)
gc.images.get('image123')
self.fail('No SSL exception raised')
except SSL.Error as e:
diff --git a/glanceclient/tests/unit/v2/test_schemas.py b/glanceclient/tests/unit/v2/test_schemas.py
index b084d14..60442a8 100644
--- a/glanceclient/tests/unit/v2/test_schemas.py
+++ b/glanceclient/tests/unit/v2/test_schemas.py
@@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-from jsonpatch import JsonPatch
+import jsonpatch
import testtools
import warlock
@@ -61,7 +61,8 @@ _SCHEMA = schemas.Schema({
def compare_json_patches(a, b):
"""Return 0 if a and b describe the same JSON patch."""
- return JsonPatch.from_string(a) == JsonPatch.from_string(b)
+ return(jsonpatch.JsonPatch.from_string(a) ==
+ jsonpatch.JsonPatch.from_string(b))
class TestSchemaProperty(testtools.TestCase):