From 54fa006ea2ed5568b276a176c078bc782da58473 Mon Sep 17 00:00:00 2001 From: Ashleigh Farnham Date: Wed, 28 Jan 2015 15:32:07 -0800 Subject: [PATCH] Update DatastoreNotFound status code to 404 Explicitly specifying DatastoreNotFound exception to return http status code 404. Previously we weren't specifying the status code for the exception and were returning 400 by default. The unit test depending on the previous status code has been updated to reflect this change. Closes-Bug: 1415031 Change-Id: I30bd97d53d1d51704133eb63e25f32a20cf0d9a1 --- trove/common/wsgi.py | 3 ++- trove/tests/api/backups.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/trove/common/wsgi.py b/trove/common/wsgi.py index d20568439a..6d05476e07 100644 --- a/trove/common/wsgi.py +++ b/trove/common/wsgi.py @@ -338,7 +338,8 @@ class Controller(object): exception.DatabaseNotFound, exception.QuotaResourceUnknown, exception.BackupFileNotFound, - exception.ClusterNotFound + exception.ClusterNotFound, + exception.DatastoreNotFound, ], webob.exc.HTTPConflict: [ exception.BackupNotCompleteError, diff --git a/trove/tests/api/backups.py b/trove/tests/api/backups.py index 4099e99cee..e6b9277a1a 100644 --- a/trove/tests/api/backups.py +++ b/trove/tests/api/backups.py @@ -245,7 +245,7 @@ class ListBackups(object): @test def test_backup_list_filter_datastore_not_found(self): """Test list backups and filter by datastore.""" - assert_raises(exceptions.BadRequest, instance_info.dbaas.backups.list, + assert_raises(exceptions.NotFound, instance_info.dbaas.backups.list, datastore='NOT_FOUND') @test