++ headers={"Accept":
++ "text/html,*/*"}
++ )
++ self.assertEqual(response.status_int, 404)
++ self.assertEqual(response.content_type, "application/json")
++ self.assertTrue(response.json['error_message'])
++
++ def test_json_parsable_error_middleware_translation_400(self):
++ # Ensure translated messages get placed properly into json faults
++ self.stubs.Set(gettextutils, 'get_localized_message',
++ self._fake_get_localized_message)
++ response = self.post_json('/alarms', params={},
++ expect_errors=True,
++ headers={"Accept":
++ "application/json"}
++ )
++ self.assertEqual(response.status_int, 400)
++ self.assertEqual(response.content_type, "application/json")
++ self.assertTrue(response.json['error_message'])
++ self.assertEqual(response.json['error_message']['faultstring'],
++ self.no_lang_translated_error)
++
++ def test_xml_parsable_error_middleware_404(self):
++ response = self.get_json('/invalid_path',
++ expect_errors=True,
++ headers={"Accept":
++ "application/xml,*/*"}
++ )
++ self.assertEqual(response.status_int, 404)
++ self.assertEqual(response.content_type, "application/xml")
++ self.assertEqual(response.xml.tag, 'error_message')
++ response = self.get_json('/invalid_path',
++ expect_errors=True,
++ headers={"Accept":
++ "application/json;q=0.8 \
++ ,application/xml"}
++ )
++ self.assertEqual(response.status_int, 404)
++ self.assertEqual(response.content_type, "application/xml")
++ self.assertEqual(response.xml.tag, 'error_message')
++
++ def test_xml_parsable_error_middleware_translation_400(self):
++ # Ensure translated messages get placed properly into xml faults
++ self.stubs.Set(gettextutils, 'get_localized_message',
++ self._fake_get_localized_message)
++
++ response = self.post_json('/alarms', params={},
++ expect_errors=True,
++ headers={"Accept":
++ "application/xml,*/*"}
++ )
++ self.assertEqual(response.status_int, 400)
++ self.assertEqual(response.content_type, "application/xml")
++ self.assertEqual(response.xml.tag, 'error_message')
++ fault = response.xml.findall('./error/faultstring')
++ for fault_string in fault:
++ self.assertEqual(fault_string.text, self.no_lang_translated_error)
++
++ def test_best_match_language(self):
++ # Ensure that we are actually invoking language negotiation
++ self.stubs.Set(gettextutils, 'get_localized_message',
++ self._fake_get_localized_message)
++
++ response = self.post_json('/alarms', params={},
++ expect_errors=True,
++ headers={"Accept":
++ "application/xml,*/*",
++ "Accept-Language":
++ "en-US"}
++ )
++ self.assertEqual(response.status_int, 400)
++ self.assertEqual(response.content_type, "application/xml")
++ self.assertEqual(response.xml.tag, 'error_message')
++ fault = response.xml.findall('./error/faultstring')
++ for fault_string in fault:
++ self.assertEqual(fault_string.text, self.en_US_translated_error)
++
++ def test_translated_then_untranslated_error(self):
++ resp = self.get_json('/alarms/alarm-id-3', expect_errors=True)
++ self.assertEqual(resp.status_code, 404)
++ self.assertEqual(json.loads(resp.body)['error_message']
++ ['faultstring'], "Alarm alarm-id-3 Not Found")
++
++ cls = 'ceilometer.api.controllers.v2.EntityNotFound'
++ with mock.patch(cls) as CustomErrorClass:
++ CustomErrorClass.return_value = wsme.exc.ClientSideError(
++ "untranslated_error")
++ resp = self.get_json('/alarms/alarm-id-5', expect_errors=True)
++
++ self.assertEqual(resp.status_code, 400)
++ self.assertEqual(json.loads(resp.body)['error_message']
++ ['faultstring'], "untranslated_error")
+diff --git a/tests/api/v2/test_statistics_scenarios.py b/tests/api/v2/test_statistics_scenarios.py
+index 38da05f..aeb93bc 100644
+--- a/tests/api/v2/test_statistics_scenarios.py
++++ b/tests/api/v2/test_statistics_scenarios.py
+@@ -1234,15 +1234,17 @@ class TestGroupBySource(base.FunctionalTest,
+ # tests.
+
+ scenarios = [
+- ('mongodb',
+- dict(database_connection=tests_db.MongoDBFakeConnectionUrl())),
+- ('hbase', dict(database_connection='hbase://__test__')),
+- ('db2', dict(database_connection=tests_db.DB2FakeConnectionUrl())),
++ # Test scenarios dropped by Ubuntu packaging.
++ #('mongodb',
++ # dict(database_connection=tests_db.MongoDBFakeConnectionUrl())),
++ #('hbase', dict(database_connection='hbase://__test__')),
++ #('db2', dict(database_connection=tests_db.DB2FakeConnectionUrl())),
+ ]
+
+ PATH = '/meters/instance/statistics'
+
+ def setUp(self):
++ self.skipTest('Skipped by Ubuntu Packaging.')
+ super(TestGroupBySource, self).setUp()
+
+ test_sample_data = (
+diff --git a/tests/collector/dispatcher/test_db.py b/tests/collector/dispatcher/test_db.py
+index a538a5d..7ca68ed 100644
+--- a/tests/collector/dispatcher/test_db.py
++++ b/tests/collector/dispatcher/test_db.py
+@@ -30,7 +30,10 @@ class TestDispatcherDB(tests_base.TestCase):
+
+ def setUp(self):
+ super(TestDispatcherDB, self).setUp()
+- self.dispatcher = database.DatabaseDispatcher(cfg.CONF)
++ try:
++ self.dispatcher = database.DatabaseDispatcher(cfg.CONF)