From 8785242de2f8c1ecda3859125f93e8c9c00ec357 Mon Sep 17 00:00:00 2001 From: Tatjana Dehler Date: Mon, 29 Apr 2019 15:28:45 +0200 Subject: [PATCH] mgr/dashboard/qa: Fix a few linting issues in dashboard backend tests Signed-off-by: Tatjana Dehler --- qa/tasks/mgr/dashboard/test_pool.py | 6 +++--- qa/tasks/mgr/dashboard/test_rbd.py | 13 +++++++------ qa/tasks/mgr/dashboard/test_rbd_mirroring.py | 10 ++++------ qa/tasks/mgr/dashboard/test_rgw.py | 1 - qa/tasks/mgr/dashboard/test_settings.py | 1 - qa/tasks/mgr/dashboard/test_summary.py | 1 - 6 files changed, 14 insertions(+), 18 deletions(-) diff --git a/qa/tasks/mgr/dashboard/test_pool.py b/qa/tasks/mgr/dashboard/test_pool.py index 590c35160735..e343159d43ef 100644 --- a/qa/tasks/mgr/dashboard/test_pool.py +++ b/qa/tasks/mgr/dashboard/test_pool.py @@ -102,7 +102,7 @@ class PoolTest(DashboardTestCase): prop = 'pg_num' pgp_prop = 'pg_placement_num' health = lambda: self._get('/api/health/minimal')['health']['status'] == 'HEALTH_OK' - t = 0; + t = 0 while (int(value) != pool[pgp_prop] or not health()) and t < 180: time.sleep(2) t += 2 @@ -113,7 +113,8 @@ class PoolTest(DashboardTestCase): @classmethod def tearDownClass(cls): super(PoolTest, cls).tearDownClass() - for name in ['dashboard_pool1', 'dashboard_pool2', 'dashboard_pool3', 'dashboard_pool_update1']: + for name in ['dashboard_pool1', 'dashboard_pool2', 'dashboard_pool3', + 'dashboard_pool_update1']: cls._ceph_cmd(['osd', 'pool', 'delete', name, name, '--yes-i-really-really-mean-it']) cls._ceph_cmd(['osd', 'erasure-code-profile', 'rm', 'ecprofile']) @@ -260,7 +261,6 @@ class PoolTest(DashboardTestCase): update = { 'compression_mode': None, 'compression_algorithm': None, - 'compression_mode': None, 'compression_max_blob_size': None, 'compression_required_ratio': None, } diff --git a/qa/tasks/mgr/dashboard/test_rbd.py b/qa/tasks/mgr/dashboard/test_rbd.py index f9b7dd022fa6..25725f2320e5 100644 --- a/qa/tasks/mgr/dashboard/test_rbd.py +++ b/qa/tasks/mgr/dashboard/test_rbd.py @@ -144,13 +144,14 @@ class RbdTest(DashboardTestCase): img = cls._get('/api/block/image/{}/{}'.format(pool, name)) cls._task_post("/api/block/image/{}/{}/move_trash".format(pool, name), - {'delay': delay}) + {'delay': delay}) return img['id'] @classmethod def remove_trash(cls, pool, image_id, image_name, force=False): - return cls._task_delete('/api/block/image/trash/{}/{}/?image_name={}&force={}'.format('rbd', image_id, image_name, force)) + return cls._task_delete('/api/block/image/trash/{}/{}/?image_name={}&force={}'.format( + 'rbd', image_id, image_name, force)) @classmethod def get_trash(cls, pool, image_id): @@ -687,9 +688,8 @@ class RbdTest(DashboardTestCase): def test_default_features(self): default_features = self._get('/api/block/image/default_features') - self.assertEqual(default_features, ['deep-flatten', 'exclusive-lock', - 'fast-diff', 'layering', - 'object-map']) + self.assertEqual(default_features, [ + 'deep-flatten', 'exclusive-lock', 'fast-diff', 'layering', 'object-map']) def test_image_with_special_name(self): rbd_name = 'test/rbd' @@ -737,7 +737,8 @@ class RbdTest(DashboardTestCase): def test_restore_trash(self): id = self.create_image_in_trash('rbd', 'test_rbd') - self._task_post('/api/block/image/trash/{}/{}/restore'.format('rbd', id), {'new_image_name': 'test_rbd'}) + self._task_post('/api/block/image/trash/{}/{}/restore'.format('rbd', id), + {'new_image_name': 'test_rbd'}) self._get('/api/block/image/rbd/test_rbd') self.assertStatus(200) diff --git a/qa/tasks/mgr/dashboard/test_rbd_mirroring.py b/qa/tasks/mgr/dashboard/test_rbd_mirroring.py index 5edbd890d89d..7afeaa4ad655 100644 --- a/qa/tasks/mgr/dashboard/test_rbd_mirroring.py +++ b/qa/tasks/mgr/dashboard/test_rbd_mirroring.py @@ -3,9 +3,7 @@ from __future__ import absolute_import -import time - -from .helper import DashboardTestCase, JObj, JLeaf, JList +from .helper import DashboardTestCase class RbdMirroringTest(DashboardTestCase): @@ -32,7 +30,7 @@ class RbdMirroringTest(DashboardTestCase): def update_pool(cls, pool, mirror_mode): data = {'mirror_mode': mirror_mode} return cls._task_put('/api/block/mirroring/pool/{}'.format(pool), - data) + data) @classmethod def list_peers(cls, pool): @@ -53,12 +51,12 @@ class RbdMirroringTest(DashboardTestCase): data = {'cluster_name': cluster_name, 'client_id': client_id} data.update(kwargs) return cls._task_post('/api/block/mirroring/pool/{}/peer'.format(pool), - data) + data) @classmethod def update_peer(cls, pool, peer_uuid, **kwargs): return cls._task_put('/api/block/mirroring/pool/{}/peer/{}'.format(pool, peer_uuid), - kwargs) + kwargs) @classmethod def delete_peer(cls, pool, peer_uuid): diff --git a/qa/tasks/mgr/dashboard/test_rgw.py b/qa/tasks/mgr/dashboard/test_rgw.py index b4c0676b0dd6..bbb9df987122 100644 --- a/qa/tasks/mgr/dashboard/test_rgw.py +++ b/qa/tasks/mgr/dashboard/test_rgw.py @@ -3,7 +3,6 @@ from __future__ import absolute_import import logging import urllib -import six from .helper import DashboardTestCase, JObj, JList, JLeaf diff --git a/qa/tasks/mgr/dashboard/test_settings.py b/qa/tasks/mgr/dashboard/test_settings.py index 5badf6ae4d69..bc0925df223b 100644 --- a/qa/tasks/mgr/dashboard/test_settings.py +++ b/qa/tasks/mgr/dashboard/test_settings.py @@ -3,7 +3,6 @@ from __future__ import absolute_import from .helper import DashboardTestCase, JList, JObj, JAny -from pprint import pformat class SettingsTest(DashboardTestCase): diff --git a/qa/tasks/mgr/dashboard/test_summary.py b/qa/tasks/mgr/dashboard/test_summary.py index 1a5d1e9918f9..a31f89146736 100644 --- a/qa/tasks/mgr/dashboard/test_summary.py +++ b/qa/tasks/mgr/dashboard/test_summary.py @@ -37,4 +37,3 @@ class SummaryTest(DashboardTestCase): self.assertIsNotNone(data['health_status']) self.assertIsNotNone(data['mgr_id']) self.assertIsNotNone(data['have_mon_connection']) - -- 2.47.3