Browse Source

Fix test cases expect Ubuntu specific assertion messages

Ubuntu and CentOS throw different exception messages for
SQL contraint checking.  The test cases can only assume
assertion messages created by Barbican.

Change-Id: Ic1ef76acbe178cfd5c6f2d3ab9ff97c652a3e604
Closes-bug: #1681988
tags/5.0.0.0b2
Dave McCowan 2 years ago
parent
commit
f4fc902fdb

+ 2
- 3
barbican/tests/model/repositories/test_repositories_consumers.py View File

@@ -86,9 +86,8 @@ class WhenTestingContainerConsumerRepository(utils.RepositoryTestCase):
86 86
             self.repo.create_from,
87 87
             consumer2,
88 88
             session=session)
89
-        self.assertEqual(
90
-            u"A defined SQL constraint check failed: 'UNIQUE constraint "
91
-            "failed: container_consumer_metadata.data_hash',",
89
+        self.assertIn(
90
+            "SQL constraint check failed",
92 91
             exception_result.message)
93 92
 
94 93
     def test_should_raise_no_result_found_get_container_id(self):

+ 2
- 2
barbican/tests/model/repositories/test_repositories_secret_stores.py View File

@@ -170,7 +170,7 @@ class WhenTestingSecretStoresRepo(database_utils.RepositoryTestCase):
170 170
             self._create_secret_store(name, store_plugin, crypto_plugin, False)
171 171
             self.assertFail()
172 172
         except exception.ConstraintCheck as ex:
173
-            self.assertIn("UNIQUE constraint", ex.message)
173
+            self.assertIn("SQL constraint check failed", ex.message)
174 174
 
175 175
 
176 176
 class WhenTestingProjectSecretStoreRepo(database_utils.RepositoryTestCase):
@@ -313,7 +313,7 @@ class WhenTestingProjectSecretStoreRepo(database_utils.RepositoryTestCase):
313 313
             self._create_project_store(project1.id, s_store2.id)
314 314
             self.assertFail()
315 315
         except exception.ConstraintCheck as ex:
316
-            self.assertIn("UNIQUE constraint", ex.message)
316
+            self.assertIn("SQL constraint check failed", ex.message)
317 317
 
318 318
     def test_get_secret_store_for_project(self):
319 319
         project1 = self._create_project()

Loading…
Cancel
Save