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)
|
||||
super(TestJsonImport, self).tearDown()
|
||||
|
||||
|
||||
def test_any(self):
|
||||
self.assertTrue(hasattr(c, 'json_loads'))
|
||||
|
||||
@@ -119,7 +118,6 @@ class MockHttpTest(testtools.TestCase):
|
||||
def setUp(self):
|
||||
super(MockHttpTest, self).setUp()
|
||||
|
||||
|
||||
def fake_http_connection(*args, **kwargs):
|
||||
_orig_http_connection = c.http_connection
|
||||
return_read = kwargs.get('return_read')
|
||||
@@ -210,7 +208,7 @@ class TestGetAuth(MockHttpTest):
|
||||
self.assertEquals(token, None)
|
||||
|
||||
def test_auth_v2(self):
|
||||
os_options={'tenant_name': 'asdf'}
|
||||
os_options = {'tenant_name': 'asdf'}
|
||||
c.get_keystoneclient_2_0 = fake_get_keystoneclient_2_0(os_options)
|
||||
url, token = c.get_auth('http://www.test.com', 'asdf', 'asdf',
|
||||
os_options=os_options,
|
||||
@@ -245,7 +243,7 @@ class TestGetAuth(MockHttpTest):
|
||||
self.assertTrue(token)
|
||||
|
||||
def test_auth_v2_with_os_options(self):
|
||||
os_options={'service_type': 'object-store',
|
||||
os_options = {'service_type': 'object-store',
|
||||
'endpoint_type': 'internalURL',
|
||||
'tenant_name': 'asdf'}
|
||||
c.get_keystoneclient_2_0 = fake_get_keystoneclient_2_0(os_options)
|
||||
@@ -264,7 +262,7 @@ class TestGetAuth(MockHttpTest):
|
||||
self.assertTrue(token)
|
||||
|
||||
def test_auth_v2_with_os_region_name(self):
|
||||
os_options={'region_name': 'good-region',
|
||||
os_options = {'region_name': 'good-region',
|
||||
'tenant_name': 'asdf'}
|
||||
c.get_keystoneclient_2_0 = fake_get_keystoneclient_2_0(os_options)
|
||||
url, token = c.get_auth('http://www.test.com', 'asdf', 'asdf',
|
||||
@@ -274,19 +272,17 @@ class TestGetAuth(MockHttpTest):
|
||||
self.assertTrue(token)
|
||||
|
||||
def test_auth_v2_no_endpoint(self):
|
||||
os_options={'region_name': 'unknown_region',
|
||||
os_options = {'region_name': 'unknown_region',
|
||||
'tenant_name': 'asdf'}
|
||||
c.get_keystoneclient_2_0 = fake_get_keystoneclient_2_0(
|
||||
os_options,
|
||||
c.ClientException)
|
||||
os_options, c.ClientException)
|
||||
self.assertRaises(c.ClientException, c.get_auth,
|
||||
'http://www.tests.com', 'asdf', 'asdf',
|
||||
os_options=os_options, auth_version='2.0')
|
||||
|
||||
def test_auth_v2_ks_exception(self):
|
||||
c.get_keystoneclient_2_0 = fake_get_keystoneclient_2_0(
|
||||
{},
|
||||
c.ClientException)
|
||||
{}, c.ClientException)
|
||||
self.assertRaises(c.ClientException, c.get_auth,
|
||||
'http://www.tests.com', 'asdf', 'asdf',
|
||||
os_options={},
|
||||
@@ -295,8 +291,7 @@ class TestGetAuth(MockHttpTest):
|
||||
def test_auth_v2_cacert(self):
|
||||
os_options = {'tenant_name': 'foo'}
|
||||
c.get_keystoneclient_2_0 = fake_get_keystoneclient_2_0(
|
||||
os_options,
|
||||
None)
|
||||
os_options, None)
|
||||
|
||||
auth_url_secure = 'https://www.tests.com'
|
||||
auth_url_insecure = 'https://www.tests.com/self-signed-certificate'
|
||||
@@ -324,8 +319,7 @@ class TestGetAuth(MockHttpTest):
|
||||
def test_auth_v2_insecure(self):
|
||||
os_options = {'tenant_name': 'foo'}
|
||||
c.get_keystoneclient_2_0 = fake_get_keystoneclient_2_0(
|
||||
os_options,
|
||||
None)
|
||||
os_options, None)
|
||||
|
||||
auth_url_secure = 'https://www.tests.com'
|
||||
auth_url_insecure = 'https://www.tests.com/invalid-certificate'
|
||||
@@ -492,7 +486,6 @@ class TestPutObject(MockHttpTest):
|
||||
self.assertEquals(len(w), 1)
|
||||
self.assertTrue(issubclass(w[-1].category, UserWarning))
|
||||
|
||||
|
||||
def test_server_error(self):
|
||||
body = 'c' * 60
|
||||
c.http_connection = self.fake_http_connection(500, body=body)
|
||||
|
@@ -16,6 +16,7 @@ from httplib import HTTPException
|
||||
|
||||
from eventlet import Timeout, sleep
|
||||
|
||||
|
||||
def fake_get_keystoneclient_2_0(os_options, exc=None, **kwargs):
|
||||
def fake_get_keystoneclient_2_0(auth_url,
|
||||
user,
|
||||
|
2
tox.ini
2
tox.ini
@@ -13,7 +13,7 @@ commands = python setup.py testr --testr-args="{posargs}"
|
||||
|
||||
[testenv: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]
|
||||
commands = {posargs}
|
||||
|
Reference in New Issue
Block a user