Fix bad indentation in tests
Remove a number of bad indentation errors flagged by pylint. Change-Id: I0a048d96aba09b2f14360ceffb1fe167fb613674
This commit is contained in:
parent
fed5843972
commit
9bee869cf4
|
@ -64,37 +64,37 @@ fake_services_list = [{'binary': 'cinder-scheduler',
|
|||
|
||||
|
||||
class FakeRequest(object):
|
||||
environ = {"cinder.context": context.get_admin_context()}
|
||||
GET = {}
|
||||
environ = {"cinder.context": context.get_admin_context()}
|
||||
GET = {}
|
||||
|
||||
|
||||
# NOTE(uni): deprecating service request key, binary takes precedence
|
||||
# Still keeping service key here for API compatibility sake.
|
||||
class FakeRequestWithService(object):
|
||||
environ = {"cinder.context": context.get_admin_context()}
|
||||
GET = {"service": "cinder-volume"}
|
||||
environ = {"cinder.context": context.get_admin_context()}
|
||||
GET = {"service": "cinder-volume"}
|
||||
|
||||
|
||||
class FakeRequestWithBinary(object):
|
||||
environ = {"cinder.context": context.get_admin_context()}
|
||||
GET = {"binary": "cinder-volume"}
|
||||
environ = {"cinder.context": context.get_admin_context()}
|
||||
GET = {"binary": "cinder-volume"}
|
||||
|
||||
|
||||
class FakeRequestWithHost(object):
|
||||
environ = {"cinder.context": context.get_admin_context()}
|
||||
GET = {"host": "host1"}
|
||||
environ = {"cinder.context": context.get_admin_context()}
|
||||
GET = {"host": "host1"}
|
||||
|
||||
|
||||
# NOTE(uni): deprecating service request key, binary takes precedence
|
||||
# Still keeping service key here for API compatibility sake.
|
||||
class FakeRequestWithHostService(object):
|
||||
environ = {"cinder.context": context.get_admin_context()}
|
||||
GET = {"host": "host1", "service": "cinder-volume"}
|
||||
environ = {"cinder.context": context.get_admin_context()}
|
||||
GET = {"host": "host1", "service": "cinder-volume"}
|
||||
|
||||
|
||||
class FakeRequestWithHostBinary(object):
|
||||
environ = {"cinder.context": context.get_admin_context()}
|
||||
GET = {"host": "host1", "binary": "cinder-volume"}
|
||||
environ = {"cinder.context": context.get_admin_context()}
|
||||
GET = {"host": "host1", "binary": "cinder-volume"}
|
||||
|
||||
|
||||
def fake_service_get_all(context):
|
||||
|
|
|
@ -37,7 +37,7 @@ LOG = logging.getLogger(__name__)
|
|||
|
||||
|
||||
class FakeBackupException(Exception):
|
||||
pass
|
||||
pass
|
||||
|
||||
|
||||
class BackupTestCase(test.TestCase):
|
||||
|
|
|
@ -115,13 +115,13 @@ class FakeHVSCommon(rest_common.HVSCommon):
|
|||
|
||||
if self.test_normal:
|
||||
if url == "/xx/sessions":
|
||||
data = """{"error":{"code":0},
|
||||
"data":{"username":"admin",
|
||||
"deviceid":"210235G7J20000000000"
|
||||
}}"""
|
||||
data = """{"error":{"code":0},
|
||||
"data":{"username":"admin",
|
||||
"deviceid":"210235G7J20000000000"
|
||||
}}"""
|
||||
if url == "sessions":
|
||||
data = """{"error":{"code":0},
|
||||
"data":{"ID":11}}"""
|
||||
data = """{"error":{"code":0},
|
||||
"data":{"ID":11}}"""
|
||||
|
||||
if url == "storagepool":
|
||||
data = """{"error":{"code":0},
|
||||
|
|
|
@ -340,89 +340,89 @@ class FakeDirectCMODEServerHandler(FakeHTTPRequestHandler):
|
|||
</lun-map-info></attributes-list><num-records>1</num-records>
|
||||
</results>"""
|
||||
elif 'lun-map' == api:
|
||||
body = """<results status="passed"><lun-id-assigned>1
|
||||
</lun-id-assigned>
|
||||
</results>"""
|
||||
body = """<results status="passed"><lun-id-assigned>1
|
||||
</lun-id-assigned>
|
||||
</results>"""
|
||||
elif 'lun-get-geometry' == api:
|
||||
body = """<results status="passed"><bytes-per-sector>256
|
||||
</bytes-per-sector><cylinders>512</cylinders><max-resize-size>
|
||||
3221225472</max-resize-size><sectors-per-track>512
|
||||
</sectors-per-track><size>2147483648</size>
|
||||
<tracks-per-cylinder>256</tracks-per-cylinder></results>"""
|
||||
body = """<results status="passed"><bytes-per-sector>256
|
||||
</bytes-per-sector><cylinders>512</cylinders><max-resize-size>
|
||||
3221225472</max-resize-size><sectors-per-track>512
|
||||
</sectors-per-track><size>2147483648</size>
|
||||
<tracks-per-cylinder>256</tracks-per-cylinder></results>"""
|
||||
elif 'iscsi-service-get-iter' == api:
|
||||
body = """<results status="passed"><attributes-list>
|
||||
<iscsi-service-info>
|
||||
<alias-name>openstack</alias-name>
|
||||
<is-available>true</is-available>
|
||||
<node-name>iqn.1992-08.com.netapp:sn.fa9:vs.105</node-name>
|
||||
<vserver>openstack</vserver></iscsi-service-info>
|
||||
</attributes-list><num-records>1</num-records></results>"""
|
||||
body = """<results status="passed"><attributes-list>
|
||||
<iscsi-service-info>
|
||||
<alias-name>openstack</alias-name>
|
||||
<is-available>true</is-available>
|
||||
<node-name>iqn.1992-08.com.netapp:sn.fa9:vs.105</node-name>
|
||||
<vserver>openstack</vserver></iscsi-service-info>
|
||||
</attributes-list><num-records>1</num-records></results>"""
|
||||
elif 'iscsi-interface-get-iter' == api:
|
||||
body = """<results status="passed"><attributes-list>
|
||||
<iscsi-interface-list-entry-info><current-node>
|
||||
fas3170rre-cmode-01
|
||||
</current-node><current-port>e1b-1165</current-port>
|
||||
<interface-name>
|
||||
iscsi_data_if</interface-name>
|
||||
<ip-address>10.63.165.216</ip-address>
|
||||
<ip-port>3260</ip-port><is-interface-enabled>true
|
||||
</is-interface-enabled>
|
||||
<relative-port-id>5</relative-port-id>
|
||||
<tpgroup-name>iscsi_data_if</tpgroup-name>
|
||||
<tpgroup-tag>1038</tpgroup-tag><vserver>
|
||||
openstack</vserver>
|
||||
</iscsi-interface-list-entry-info></attributes-list>
|
||||
<num-records>1</num-records></results>"""
|
||||
body = """<results status="passed"><attributes-list>
|
||||
<iscsi-interface-list-entry-info><current-node>
|
||||
fas3170rre-cmode-01
|
||||
</current-node><current-port>e1b-1165</current-port>
|
||||
<interface-name>
|
||||
iscsi_data_if</interface-name>
|
||||
<ip-address>10.63.165.216</ip-address>
|
||||
<ip-port>3260</ip-port><is-interface-enabled>true
|
||||
</is-interface-enabled>
|
||||
<relative-port-id>5</relative-port-id>
|
||||
<tpgroup-name>iscsi_data_if</tpgroup-name>
|
||||
<tpgroup-tag>1038</tpgroup-tag><vserver>
|
||||
openstack</vserver>
|
||||
</iscsi-interface-list-entry-info></attributes-list>
|
||||
<num-records>1</num-records></results>"""
|
||||
elif 'igroup-create' == api:
|
||||
body = """<results status="passed"/>"""
|
||||
body = """<results status="passed"/>"""
|
||||
elif 'igroup-add' == api:
|
||||
body = """<results status="passed"/>"""
|
||||
body = """<results status="passed"/>"""
|
||||
elif 'clone-create' == api:
|
||||
body = """<results status="passed"/>"""
|
||||
body = """<results status="passed"/>"""
|
||||
elif 'lun-unmap' == api:
|
||||
body = """<results status="passed"/>"""
|
||||
body = """<results status="passed"/>"""
|
||||
elif 'system-get-ontapi-version' == api:
|
||||
body = """<results status="passed">
|
||||
<major-version>1</major-version>
|
||||
<minor-version>19</minor-version>
|
||||
</results>"""
|
||||
body = """<results status="passed">
|
||||
<major-version>1</major-version>
|
||||
<minor-version>19</minor-version>
|
||||
</results>"""
|
||||
elif 'vserver-get-iter' == api:
|
||||
body = """<results status="passed"><attributes-list>
|
||||
<vserver-info>
|
||||
<vserver-name>vserver</vserver-name>
|
||||
<vserver-type>node</vserver-type>
|
||||
</vserver-info>
|
||||
</attributes-list>
|
||||
<num-records>1</num-records></results>"""
|
||||
body = """<results status="passed"><attributes-list>
|
||||
<vserver-info>
|
||||
<vserver-name>vserver</vserver-name>
|
||||
<vserver-type>node</vserver-type>
|
||||
</vserver-info>
|
||||
</attributes-list>
|
||||
<num-records>1</num-records></results>"""
|
||||
elif 'ems-autosupport-log' == api:
|
||||
body = """<results status="passed"/>"""
|
||||
body = """<results status="passed"/>"""
|
||||
elif 'lun-resize' == api:
|
||||
body = """<results status="passed"/>"""
|
||||
body = """<results status="passed"/>"""
|
||||
elif 'lun-get-geometry' == api:
|
||||
body = """<results status="passed">
|
||||
<size>1</size>
|
||||
<bytes-per-sector>2</bytes-per-sector>
|
||||
<sectors-per-track>8</sectors-per-track>
|
||||
<tracks-per-cylinder>2</tracks-per-cylinder>
|
||||
<cylinders>4</cylinders>
|
||||
<max-resize-size>5</max-resize-size>
|
||||
</results>"""
|
||||
body = """<results status="passed">
|
||||
<size>1</size>
|
||||
<bytes-per-sector>2</bytes-per-sector>
|
||||
<sectors-per-track>8</sectors-per-track>
|
||||
<tracks-per-cylinder>2</tracks-per-cylinder>
|
||||
<cylinders>4</cylinders>
|
||||
<max-resize-size>5</max-resize-size>
|
||||
</results>"""
|
||||
elif 'volume-options-list-info' == api:
|
||||
body = """<results status="passed">
|
||||
<options>
|
||||
<option>
|
||||
<name>compression</name>
|
||||
<value>off</value>
|
||||
</option>
|
||||
</options>
|
||||
</results>"""
|
||||
body = """<results status="passed">
|
||||
<options>
|
||||
<option>
|
||||
<name>compression</name>
|
||||
<value>off</value>
|
||||
</option>
|
||||
</options>
|
||||
</results>"""
|
||||
elif 'lun-move' == api:
|
||||
body = """<results status="passed"/>"""
|
||||
body = """<results status="passed"/>"""
|
||||
else:
|
||||
# Unknown API
|
||||
s.send_response(500)
|
||||
s.end_headers
|
||||
return
|
||||
# Unknown API
|
||||
s.send_response(500)
|
||||
s.end_headers
|
||||
return
|
||||
s.send_response(200)
|
||||
s.send_header("Content-Type", "text/xml; charset=utf-8")
|
||||
s.end_headers()
|
||||
|
@ -989,15 +989,15 @@ class FakeDirect7MODEServerHandler(FakeHTTPRequestHandler):
|
|||
<initiator-groups/>
|
||||
</results>"""
|
||||
elif 'lun-map' == api:
|
||||
body = """<results status="passed"><lun-id-assigned>1
|
||||
</lun-id-assigned>
|
||||
</results>"""
|
||||
body = """<results status="passed"><lun-id-assigned>1
|
||||
</lun-id-assigned>
|
||||
</results>"""
|
||||
elif 'iscsi-node-get-name' == api:
|
||||
body = """<results status="passed">
|
||||
body = """<results status="passed">
|
||||
<node-name>iqn.1992-08.com.netapp:sn.135093938</node-name>
|
||||
</results>"""
|
||||
elif 'iscsi-portal-list-info' == api:
|
||||
body = """<results status="passed">
|
||||
body = """<results status="passed">
|
||||
<iscsi-portal-list-entries>
|
||||
<iscsi-portal-list-entry-info>
|
||||
<ip-address>10.61.176.156</ip-address>
|
||||
|
@ -1008,11 +1008,11 @@ class FakeDirect7MODEServerHandler(FakeHTTPRequestHandler):
|
|||
</iscsi-portal-list-entries>
|
||||
</results>"""
|
||||
elif 'igroup-create' == api:
|
||||
body = """<results status="passed"/>"""
|
||||
body = """<results status="passed"/>"""
|
||||
elif 'igroup-add' == api:
|
||||
body = """<results status="passed"/>"""
|
||||
body = """<results status="passed"/>"""
|
||||
elif 'clone-start' == api:
|
||||
body = """<results status="passed">
|
||||
body = """<results status="passed">
|
||||
<clone-id>
|
||||
<clone-id-info>
|
||||
<volume-uuid>2d50ecf4-c288-11e0-9282-00a09825b3b5</volume-uuid>
|
||||
|
@ -1021,7 +1021,7 @@ class FakeDirect7MODEServerHandler(FakeHTTPRequestHandler):
|
|||
</clone-id>
|
||||
</results>"""
|
||||
elif 'clone-list-status' == api:
|
||||
body = """<results status="passed">
|
||||
body = """<results status="passed">
|
||||
<status>
|
||||
<ops-info>
|
||||
<clone-state>completed</clone-state>
|
||||
|
@ -1029,43 +1029,43 @@ class FakeDirect7MODEServerHandler(FakeHTTPRequestHandler):
|
|||
</status>
|
||||
</results>"""
|
||||
elif 'lun-unmap' == api:
|
||||
body = """<results status="passed"/>"""
|
||||
body = """<results status="passed"/>"""
|
||||
elif 'system-get-ontapi-version' == api:
|
||||
body = """<results status="passed">
|
||||
<major-version>1</major-version>
|
||||
<minor-version>8</minor-version>
|
||||
</results>"""
|
||||
body = """<results status="passed">
|
||||
<major-version>1</major-version>
|
||||
<minor-version>8</minor-version>
|
||||
</results>"""
|
||||
elif 'lun-set-space-reservation-info' == api:
|
||||
body = """<results status="passed"/>"""
|
||||
body = """<results status="passed"/>"""
|
||||
elif 'ems-autosupport-log' == api:
|
||||
body = """<results status="passed"/>"""
|
||||
body = """<results status="passed"/>"""
|
||||
elif 'lun-resize' == api:
|
||||
body = """<results status="passed"/>"""
|
||||
body = """<results status="passed"/>"""
|
||||
elif 'lun-get-geometry' == api:
|
||||
body = """<results status="passed">
|
||||
<size>1</size>
|
||||
<bytes-per-sector>2</bytes-per-sector>
|
||||
<sectors-per-track>8</sectors-per-track>
|
||||
<tracks-per-cylinder>2</tracks-per-cylinder>
|
||||
<cylinders>4</cylinders>
|
||||
<max-resize-size>5</max-resize-size>
|
||||
</results>"""
|
||||
body = """<results status="passed">
|
||||
<size>1</size>
|
||||
<bytes-per-sector>2</bytes-per-sector>
|
||||
<sectors-per-track>8</sectors-per-track>
|
||||
<tracks-per-cylinder>2</tracks-per-cylinder>
|
||||
<cylinders>4</cylinders>
|
||||
<max-resize-size>5</max-resize-size>
|
||||
</results>"""
|
||||
elif 'volume-options-list-info' == api:
|
||||
body = """<results status="passed">
|
||||
<options>
|
||||
<option>
|
||||
<name>compression</name>
|
||||
<value>off</value>
|
||||
</option>
|
||||
</options>
|
||||
</results>"""
|
||||
body = """<results status="passed">
|
||||
<options>
|
||||
<option>
|
||||
<name>compression</name>
|
||||
<value>off</value>
|
||||
</option>
|
||||
</options>
|
||||
</results>"""
|
||||
elif 'lun-move' == api:
|
||||
body = """<results status="passed"/>"""
|
||||
body = """<results status="passed"/>"""
|
||||
else:
|
||||
# Unknown API
|
||||
s.send_response(500)
|
||||
s.end_headers
|
||||
return
|
||||
# Unknown API
|
||||
s.send_response(500)
|
||||
s.end_headers
|
||||
return
|
||||
s.send_response(200)
|
||||
s.send_header("Content-Type", "text/xml; charset=utf-8")
|
||||
s.end_headers()
|
||||
|
|
|
@ -357,7 +357,7 @@ class NetappDirectCmodeNfsDriverTestCase(test.TestCase):
|
|||
drv._mounted_shares.remove('testshare')
|
||||
|
||||
if (share == 'testshare' and file_name == 'img-cache-id'):
|
||||
pass
|
||||
pass
|
||||
else:
|
||||
LOG.warn(_("Share %(share)s and file name %(file_name)s")
|
||||
% {'share': share, 'file_name': file_name})
|
||||
|
|
|
@ -204,30 +204,30 @@ class FakeDirectCMODEServerHandler(FakeHTTPRequestHandler):
|
|||
</attributes-list>
|
||||
<num-records>4</num-records></results>"""
|
||||
elif 'aggr-options-list-info' == localname:
|
||||
body = """<results status="passed">
|
||||
<options>
|
||||
<aggr-option-info>
|
||||
<name>ha_policy</name>
|
||||
<value>cfo</value>
|
||||
</aggr-option-info>
|
||||
<aggr-option-info>
|
||||
<name>raidtype</name>
|
||||
<value>raid_dp</value>
|
||||
</aggr-option-info>
|
||||
</options>
|
||||
</results>"""
|
||||
body = """<results status="passed">
|
||||
<options>
|
||||
<aggr-option-info>
|
||||
<name>ha_policy</name>
|
||||
<value>cfo</value>
|
||||
</aggr-option-info>
|
||||
<aggr-option-info>
|
||||
<name>raidtype</name>
|
||||
<value>raid_dp</value>
|
||||
</aggr-option-info>
|
||||
</options>
|
||||
</results>"""
|
||||
elif 'sis-get-iter' == localname:
|
||||
body = """<results status="passed">
|
||||
<attributes-list>
|
||||
<sis-status-info>
|
||||
<path>/vol/iscsi</path>
|
||||
<is-compression-enabled>
|
||||
true
|
||||
</is-compression-enabled>
|
||||
<state>enabled</state>
|
||||
</sis-status-info>
|
||||
</attributes-list>
|
||||
</results>"""
|
||||
body = """<results status="passed">
|
||||
<attributes-list>
|
||||
<sis-status-info>
|
||||
<path>/vol/iscsi</path>
|
||||
<is-compression-enabled>
|
||||
true
|
||||
</is-compression-enabled>
|
||||
<state>enabled</state>
|
||||
</sis-status-info>
|
||||
</attributes-list>
|
||||
</results>"""
|
||||
elif 'storage-disk-get-iter' == localname:
|
||||
body = """<results status="passed">
|
||||
<attributes-list>
|
||||
|
@ -239,10 +239,10 @@ class FakeDirectCMODEServerHandler(FakeHTTPRequestHandler):
|
|||
</attributes-list>
|
||||
</results>"""
|
||||
else:
|
||||
# Unknown API
|
||||
s.send_response(500)
|
||||
s.end_headers
|
||||
return
|
||||
# Unknown API
|
||||
s.send_response(500)
|
||||
s.end_headers
|
||||
return
|
||||
s.send_response(200)
|
||||
s.send_header("Content-Type", "text/xml; charset=utf-8")
|
||||
s.end_headers()
|
||||
|
|
|
@ -551,8 +551,8 @@ class GenericUtilsTestCase(test.TestCase):
|
|||
def test_get_file_mode(self, mock_stat):
|
||||
|
||||
class stat_result:
|
||||
st_mode = 0o777
|
||||
st_gid = 33333
|
||||
st_mode = 0o777
|
||||
st_gid = 33333
|
||||
|
||||
test_file = '/var/tmp/made_up_file'
|
||||
mock_stat.return_value = stat_result
|
||||
|
@ -564,8 +564,8 @@ class GenericUtilsTestCase(test.TestCase):
|
|||
def test_get_file_gid(self, mock_stat):
|
||||
|
||||
class stat_result:
|
||||
st_mode = 0o777
|
||||
st_gid = 33333
|
||||
st_mode = 0o777
|
||||
st_gid = 33333
|
||||
|
||||
test_file = '/var/tmp/made_up_file'
|
||||
mock_stat.return_value = stat_result
|
||||
|
|
|
@ -74,8 +74,8 @@ class TestWindowsDriver(test.TestCase):
|
|||
windows_utils.WindowsUtils.__init__ = fake_wutils__init__
|
||||
|
||||
def fake_local_path(self, volume):
|
||||
return os.path.join(CONF.windows_iscsi_lun_path,
|
||||
str(volume['name']) + ".vhd")
|
||||
return os.path.join(CONF.windows_iscsi_lun_path,
|
||||
str(volume['name']) + ".vhd")
|
||||
|
||||
def test_check_for_setup_errors(self):
|
||||
mox = self._mox
|
||||
|
|
Loading…
Reference in New Issue