From 779d5580d00f2da23dc99f828bcb896162007aa7 Mon Sep 17 00:00:00 2001 From: Jesse Yang Date: Wed, 11 Nov 2020 12:03:05 -0800 Subject: [PATCH] Fix pytest --- tests/databases/api_tests.py | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/tests/databases/api_tests.py b/tests/databases/api_tests.py index 62a14005932b1..4cfe14aee1b95 100644 --- a/tests/databases/api_tests.py +++ b/tests/databases/api_tests.py @@ -297,17 +297,9 @@ def test_create_database_uri_validate(self): rv = self.client.post(uri, json=database_data) response = json.loads(rv.data.decode("utf-8")) self.assertEqual(rv.status_code, 400) - expected_response = { - "message": { - "sqlalchemy_uri": [ - "Invalid connection string, a valid string usually " - "follows:'DRIVER://USER:PASSWORD@DB-HOST/DATABASE-NAME'" - "

Example:'postgresql://user:password@your-postgres-db/database'" - "

" - ] - } - } - self.assertEqual(response, expected_response) + self.assertIn( + "Invalid connection string", response["message"]["sqlalchemy_uri"][0], + ) def test_create_database_fail_sqllite(self): """ @@ -456,17 +448,9 @@ def test_update_database_uri_validate(self): rv = self.client.put(uri, json=database_data) response = json.loads(rv.data.decode("utf-8")) self.assertEqual(rv.status_code, 400) - expected_response = { - "message": { - "sqlalchemy_uri": [ - "Invalid connection string, a valid string usually " - "follows:'DRIVER://USER:PASSWORD@DB-HOST/DATABASE-NAME'" - "

Example:'postgresql://user:password@your-postgres-db/database'" - "

" - ] - } - } - self.assertEqual(response, expected_response) + self.assertIn( + "Invalid connection string", response["message"]["sqlalchemy_uri"][0], + ) def test_delete_database(self): """