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
This commit is contained in:
Dave McCowan 2017-04-18 09:01:19 -04:00
parent 42a2ec16a4
commit f4fc902fdb
2 changed files with 4 additions and 5 deletions

View File

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

View File

@ -170,7 +170,7 @@ class WhenTestingSecretStoresRepo(database_utils.RepositoryTestCase):
self._create_secret_store(name, store_plugin, crypto_plugin, False)
self.assertFail()
except exception.ConstraintCheck as ex:
self.assertIn("UNIQUE constraint", ex.message)
self.assertIn("SQL constraint check failed", ex.message)
class WhenTestingProjectSecretStoreRepo(database_utils.RepositoryTestCase):
@ -313,7 +313,7 @@ class WhenTestingProjectSecretStoreRepo(database_utils.RepositoryTestCase):
self._create_project_store(project1.id, s_store2.id)
self.assertFail()
except exception.ConstraintCheck as ex:
self.assertIn("UNIQUE constraint", ex.message)
self.assertIn("SQL constraint check failed", ex.message)
def test_get_secret_store_for_project(self):
project1 = self._create_project()