def test_table_not_exist_exception_in_get_item(self): cluster_handler_mock = mock.Mock() cluster_handler_mock.execute_query.return_value = None table_repo = CassandraTableInfoRepository(cluster_handler_mock) context = mock.Mock(tenant='fake_tenant') with self.assertRaises(exception.TableNotExistsException) as raises_cm: table_repo.get(context, "nonexistenttable") ex = raises_cm.exception self.assertIn("Table 'nonexistenttable' does not exist", ex.message)
def test_table_not_exist_exception_in_get_item(self): cluster_handler_mock = mock.Mock() cluster_handler_mock.execute_query.return_value = None table_repo = CassandraTableInfoRepository(cluster_handler_mock) context = mock.Mock(tenant='fake_tenant') with self.assertRaises( exception.TableNotExistsException) as raises_cm: table_repo.get(context, "nonexistenttable") ex = raises_cm.exception self.assertIn("Table 'nonexistenttable' does not exist", ex.message)