From 6d29762f877c6aa587ad673f101e57d5011daca4 Mon Sep 17 00:00:00 2001 From: zhongjun Date: Thu, 14 Sep 2017 15:06:31 +0800 Subject: [PATCH] Delete unused test check TrivialFix Change-Id: Id93a5062c48e99afc22594f05cbf29cffce2494e --- manila/tests/api/v1/test_share_snapshots.py | 11 ++--------- manila/tests/api/v2/test_share_group_snapshots.py | 10 ++-------- manila/tests/api/v2/test_share_groups.py | 9 ++------- manila/tests/api/v2/test_share_instances.py | 10 ++-------- manila/tests/api/v2/test_share_replicas.py | 12 +++--------- .../tests/api/v2/test_share_snapshot_instances.py | 15 ++++----------- manila/tests/api/v2/test_share_snapshots.py | 10 ++-------- 7 files changed, 17 insertions(+), 60 deletions(-) diff --git a/manila/tests/api/v1/test_share_snapshots.py b/manila/tests/api/v1/test_share_snapshots.py index b698a8c153..56ce60b760 100644 --- a/manila/tests/api/v1/test_share_snapshots.py +++ b/manila/tests/api/v1/test_share_snapshots.py @@ -23,7 +23,6 @@ from manila.api.v1 import share_snapshots from manila.common import constants from manila import context from manila import db -from manila import exception from manila.share import api as share_api from manila import test from manila.tests.api.contrib import stubs @@ -386,14 +385,8 @@ class ShareSnapshotAdminActionsAPITest(test.TestCase): # validate response code and model status self.assertEqual(valid_code, resp.status_int) - if valid_code == 404: - self.assertRaises(exception.NotFound, - db_access_method, - ctxt, - model['id']) - else: - actual_model = db_access_method(ctxt, model['id']) - self.assertEqual(valid_status, actual_model['status']) + actual_model = db_access_method(ctxt, model['id']) + self.assertEqual(valid_status, actual_model['status']) @ddt.data(*fakes.fixture_reset_status_with_different_roles_v1) @ddt.unpack diff --git a/manila/tests/api/v2/test_share_group_snapshots.py b/manila/tests/api/v2/test_share_group_snapshots.py index e1eebb501e..fc0b5ba797 100644 --- a/manila/tests/api/v2/test_share_group_snapshots.py +++ b/manila/tests/api/v2/test_share_group_snapshots.py @@ -597,11 +597,5 @@ class ShareGroupSnapshotAPITest(test.TestCase): # Validate response code and model status self.assertEqual(valid_code, resp.status_int) - if valid_code == 404: - self.assertRaises(exception.NotFound, - db.share_group_snapshot_get, - ctxt, - group_snap['id']) - else: - actual_model = db.share_group_snapshot_get(ctxt, group_snap['id']) - self.assertEqual(valid_status, actual_model['status']) + actual_model = db.share_group_snapshot_get(ctxt, group_snap['id']) + self.assertEqual(valid_status, actual_model['status']) diff --git a/manila/tests/api/v2/test_share_groups.py b/manila/tests/api/v2/test_share_groups.py index 0ce9abec6a..bdccfe5f8e 100644 --- a/manila/tests/api/v2/test_share_groups.py +++ b/manila/tests/api/v2/test_share_groups.py @@ -937,13 +937,8 @@ class ShareGroupAPITest(test.TestCase): # validate response code and model status self.assertEqual(valid_code, resp.status_int) - if valid_code == 404: - self.assertRaises( - exception.NotFound, - db.share_group_get, ctxt, share_group['id']) - else: - actual_model = db.share_group_get(ctxt, share_group['id']) - self.assertEqual(valid_status, actual_model['status']) + actual_model = db.share_group_get(ctxt, share_group['id']) + self.assertEqual(valid_status, actual_model['status']) @ddt.data(*fakes.fixture_force_delete_with_different_roles) @ddt.unpack diff --git a/manila/tests/api/v2/test_share_instances.py b/manila/tests/api/v2/test_share_instances.py index 91828cad47..89c38dac87 100644 --- a/manila/tests/api/v2/test_share_instances.py +++ b/manila/tests/api/v2/test_share_instances.py @@ -249,14 +249,8 @@ class ShareInstancesAPITest(test.TestCase): # validate response code and model status self.assertEqual(valid_code, resp.status_int) - if valid_code == 404: - self.assertRaises(exception.NotFound, - db_access_method, - ctxt, - model['id']) - else: - actual_model = db_access_method(ctxt, model['id']) - self.assertEqual(valid_status, actual_model['status']) + actual_model = db_access_method(ctxt, model['id']) + self.assertEqual(valid_status, actual_model['status']) @ddt.data(*fakes.fixture_reset_status_with_different_roles) @ddt.unpack diff --git a/manila/tests/api/v2/test_share_replicas.py b/manila/tests/api/v2/test_share_replicas.py index f847579571..a88fa3b015 100644 --- a/manila/tests/api/v2/test_share_replicas.py +++ b/manila/tests/api/v2/test_share_replicas.py @@ -580,15 +580,9 @@ class ShareReplicasApiTest(test.TestCase): # validate response code and model status self.assertEqual(valid_code, resp.status_int) - if valid_code == 404: - self.assertRaises(exception.ShareReplicaNotFound, - share_replicas.db.share_replica_get, - context, - replica['id']) - else: - actual_replica = share_replicas.db.share_replica_get( - context, replica['id']) - self.assertEqual(valid_status, actual_replica[status_attr]) + actual_replica = share_replicas.db.share_replica_get( + context, replica['id']) + self.assertEqual(valid_status, actual_replica[status_attr]) @ddt.data(*fakes.fixture_reset_replica_status_with_different_roles) @ddt.unpack diff --git a/manila/tests/api/v2/test_share_snapshot_instances.py b/manila/tests/api/v2/test_share_snapshot_instances.py index 3a486ddf7f..de30e7078a 100644 --- a/manila/tests/api/v2/test_share_snapshot_instances.py +++ b/manila/tests/api/v2/test_share_snapshot_instances.py @@ -232,17 +232,10 @@ class ShareSnapshotInstancesApiTest(test.TestCase): # validate response code and model status self.assertEqual(valid_code, resp.status_int) - if valid_code == 404: - self.assertRaises(exception.ShareSnapshotInstanceNotFound, - (share_snapshot_instances.db. - share_snapshot_instance_get), - context, - instance['id']) - else: - actual_instance = ( - share_snapshot_instances.db.share_snapshot_instance_get( - context, instance['id'])) - self.assertEqual(valid_status, actual_instance['status']) + actual_instance = ( + share_snapshot_instances.db.share_snapshot_instance_get( + context, instance['id'])) + self.assertEqual(valid_status, actual_instance['status']) @ddt.data(*fakes.fixture_reset_status_with_different_roles) @ddt.unpack diff --git a/manila/tests/api/v2/test_share_snapshots.py b/manila/tests/api/v2/test_share_snapshots.py index a3b78c9253..3ec7cda25e 100644 --- a/manila/tests/api/v2/test_share_snapshots.py +++ b/manila/tests/api/v2/test_share_snapshots.py @@ -626,14 +626,8 @@ class ShareSnapshotAdminActionsAPITest(test.TestCase): # validate response code and model status self.assertEqual(valid_code, resp.status_int) - if valid_code == 404: - self.assertRaises(exception.NotFound, - db_access_method, - ctxt, - model['id']) - else: - actual_model = db_access_method(ctxt, model['id']) - self.assertEqual(valid_status, actual_model['status']) + actual_model = db_access_method(ctxt, model['id']) + self.assertEqual(valid_status, actual_model['status']) @ddt.data(*fakes.fixture_reset_status_with_different_roles) @ddt.unpack