Files
python-neutronclient/neutronclient/tests/unit/osc/v2/fakes.py
Cao Xuan Hoang f4c0468b36 Use flake8-import-order plugin
In reviews we usually check import grouping but it is boring.
By using flake8-import-order plugin, we can avoid this.
It enforces loose checking so it sounds good to use it.
This flake8 plugin is already used in tempest.

Note that flake8-import-order version is pinned to avoid unexpected
breakage of pep8 job.

Setup for unit tests of hacking rules is tweaked to disable
flake8-import-order checks. This extension assumes an actual file
exists and causes hacking rule unit tests.

Change-Id: I61e683ab0119e4ae90b7107f0690528d789e3875
2017-07-06 16:47:49 +07:00

47 lines
1.9 KiB
Python

# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
import argparse
from cliff import columns as cliff_columns
import mock
from osc_lib.tests import utils
class TestNeutronClientOSCV2(utils.TestCommand):
def setUp(self):
super(TestNeutronClientOSCV2, self).setUp()
self.namespace = argparse.Namespace()
self.app.client_manager.session = mock.Mock()
self.app.client_manager.neutronclient = mock.Mock()
self.neutronclient = self.app.client_manager.neutronclient
self.addCleanup(mock.patch.stopall)
# TODO(amotoki): Move this to osc_lib
def assertListItemEqual(self, expected, actual):
self.assertEqual(len(expected), len(actual))
for item_expected, item_actual in zip(expected, actual):
self.assertItemEqual(item_expected, item_actual)
# TODO(amotoki): Move this to osc_lib
def assertItemEqual(self, expected, actual):
self.assertEqual(len(expected), len(actual))
for col_expected, col_actual in zip(expected, actual):
if isinstance(col_expected, cliff_columns.FormattableColumn):
self.assertIsInstance(col_actual, col_expected.__class__)
self.assertEqual(col_expected.human_readable(),
col_actual.human_readable())
else:
self.assertEqual(col_expected, col_actual)