Fixed pep8 errors in test directory.
Files test_swiftclient.py and utils.py had all pep8 errors fixed. Also added tests directory to tox.ini file, so that pep8 would monitor tests directory by default. Change-Id: Id60a2cd88bd814d1dcbeca951764c9d236500837 Fixes: bug #1158819
This commit is contained in:
@@ -71,7 +71,6 @@ class TestJsonImport(testtools.TestCase):
|
|||||||
reload(simplejson)
|
reload(simplejson)
|
||||||
super(TestJsonImport, self).tearDown()
|
super(TestJsonImport, self).tearDown()
|
||||||
|
|
||||||
|
|
||||||
def test_any(self):
|
def test_any(self):
|
||||||
self.assertTrue(hasattr(c, 'json_loads'))
|
self.assertTrue(hasattr(c, 'json_loads'))
|
||||||
|
|
||||||
@@ -119,7 +118,6 @@ class MockHttpTest(testtools.TestCase):
|
|||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(MockHttpTest, self).setUp()
|
super(MockHttpTest, self).setUp()
|
||||||
|
|
||||||
|
|
||||||
def fake_http_connection(*args, **kwargs):
|
def fake_http_connection(*args, **kwargs):
|
||||||
_orig_http_connection = c.http_connection
|
_orig_http_connection = c.http_connection
|
||||||
return_read = kwargs.get('return_read')
|
return_read = kwargs.get('return_read')
|
||||||
@@ -277,16 +275,14 @@ class TestGetAuth(MockHttpTest):
|
|||||||
os_options = {'region_name': 'unknown_region',
|
os_options = {'region_name': 'unknown_region',
|
||||||
'tenant_name': 'asdf'}
|
'tenant_name': 'asdf'}
|
||||||
c.get_keystoneclient_2_0 = fake_get_keystoneclient_2_0(
|
c.get_keystoneclient_2_0 = fake_get_keystoneclient_2_0(
|
||||||
os_options,
|
os_options, c.ClientException)
|
||||||
c.ClientException)
|
|
||||||
self.assertRaises(c.ClientException, c.get_auth,
|
self.assertRaises(c.ClientException, c.get_auth,
|
||||||
'http://www.tests.com', 'asdf', 'asdf',
|
'http://www.tests.com', 'asdf', 'asdf',
|
||||||
os_options=os_options, auth_version='2.0')
|
os_options=os_options, auth_version='2.0')
|
||||||
|
|
||||||
def test_auth_v2_ks_exception(self):
|
def test_auth_v2_ks_exception(self):
|
||||||
c.get_keystoneclient_2_0 = fake_get_keystoneclient_2_0(
|
c.get_keystoneclient_2_0 = fake_get_keystoneclient_2_0(
|
||||||
{},
|
{}, c.ClientException)
|
||||||
c.ClientException)
|
|
||||||
self.assertRaises(c.ClientException, c.get_auth,
|
self.assertRaises(c.ClientException, c.get_auth,
|
||||||
'http://www.tests.com', 'asdf', 'asdf',
|
'http://www.tests.com', 'asdf', 'asdf',
|
||||||
os_options={},
|
os_options={},
|
||||||
@@ -295,8 +291,7 @@ class TestGetAuth(MockHttpTest):
|
|||||||
def test_auth_v2_cacert(self):
|
def test_auth_v2_cacert(self):
|
||||||
os_options = {'tenant_name': 'foo'}
|
os_options = {'tenant_name': 'foo'}
|
||||||
c.get_keystoneclient_2_0 = fake_get_keystoneclient_2_0(
|
c.get_keystoneclient_2_0 = fake_get_keystoneclient_2_0(
|
||||||
os_options,
|
os_options, None)
|
||||||
None)
|
|
||||||
|
|
||||||
auth_url_secure = 'https://www.tests.com'
|
auth_url_secure = 'https://www.tests.com'
|
||||||
auth_url_insecure = 'https://www.tests.com/self-signed-certificate'
|
auth_url_insecure = 'https://www.tests.com/self-signed-certificate'
|
||||||
@@ -324,8 +319,7 @@ class TestGetAuth(MockHttpTest):
|
|||||||
def test_auth_v2_insecure(self):
|
def test_auth_v2_insecure(self):
|
||||||
os_options = {'tenant_name': 'foo'}
|
os_options = {'tenant_name': 'foo'}
|
||||||
c.get_keystoneclient_2_0 = fake_get_keystoneclient_2_0(
|
c.get_keystoneclient_2_0 = fake_get_keystoneclient_2_0(
|
||||||
os_options,
|
os_options, None)
|
||||||
None)
|
|
||||||
|
|
||||||
auth_url_secure = 'https://www.tests.com'
|
auth_url_secure = 'https://www.tests.com'
|
||||||
auth_url_insecure = 'https://www.tests.com/invalid-certificate'
|
auth_url_insecure = 'https://www.tests.com/invalid-certificate'
|
||||||
@@ -492,7 +486,6 @@ class TestPutObject(MockHttpTest):
|
|||||||
self.assertEquals(len(w), 1)
|
self.assertEquals(len(w), 1)
|
||||||
self.assertTrue(issubclass(w[-1].category, UserWarning))
|
self.assertTrue(issubclass(w[-1].category, UserWarning))
|
||||||
|
|
||||||
|
|
||||||
def test_server_error(self):
|
def test_server_error(self):
|
||||||
body = 'c' * 60
|
body = 'c' * 60
|
||||||
c.http_connection = self.fake_http_connection(500, body=body)
|
c.http_connection = self.fake_http_connection(500, body=body)
|
||||||
|
@@ -16,6 +16,7 @@ from httplib import HTTPException
|
|||||||
|
|
||||||
from eventlet import Timeout, sleep
|
from eventlet import Timeout, sleep
|
||||||
|
|
||||||
|
|
||||||
def fake_get_keystoneclient_2_0(os_options, exc=None, **kwargs):
|
def fake_get_keystoneclient_2_0(os_options, exc=None, **kwargs):
|
||||||
def fake_get_keystoneclient_2_0(auth_url,
|
def fake_get_keystoneclient_2_0(auth_url,
|
||||||
user,
|
user,
|
||||||
|
2
tox.ini
2
tox.ini
@@ -13,7 +13,7 @@ commands = python setup.py testr --testr-args="{posargs}"
|
|||||||
|
|
||||||
[testenv:pep8]
|
[testenv:pep8]
|
||||||
deps = pep8
|
deps = pep8
|
||||||
commands = pep8 --repeat --show-source --exclude=openstack swiftclient setup.py
|
commands = pep8 --repeat --show-source --exclude=openstack swiftclient setup.py tests
|
||||||
|
|
||||||
[testenv:venv]
|
[testenv:venv]
|
||||||
commands = {posargs}
|
commands = {posargs}
|
||||||
|
Reference in New Issue
Block a user