]> git.openstreetmap.org Git - nominatim.git/blobdiff - test/python/api/test_server_glue_v1.py
enable all API tests for sqlite and port missing features
[nominatim.git] / test / python / api / test_server_glue_v1.py
index 26e6517e53b4fe3dc8e5031d67c6d1c1b148835c..5a7430f48db2b57c668c06ef27f88b80edb704ab 100644 (file)
@@ -67,7 +67,7 @@ def test_adaptor_parse_format_use_configured():
     adaptor = FakeAdaptor(params={'format': 'json'})
 
     assert adaptor.parse_format(napi.StatusResult, 'text') == 'json'
-    assert adaptor.content_type == 'application/json'
+    assert adaptor.content_type == 'application/json; charset=utf-8'
 
 
 def test_adaptor_parse_format_invalid_value():
@@ -132,7 +132,7 @@ class TestAdaptorRaiseError:
 
 
     def test_json(self):
-        self.adaptor.content_type = 'application/json'
+        self.adaptor.content_type = 'application/json; charset=utf-8'
 
         err = self.run_raise_error('TEST', 501)
 
@@ -189,7 +189,7 @@ def test_build_response_with_status():
     assert isinstance(resp, FakeResponse)
     assert resp.status == 404
     assert resp.output == 'stuff\nmore stuff'
-    assert resp.content_type == 'application/json'
+    assert resp.content_type == 'application/json; charset=utf-8'
 
 
 def test_build_response_jsonp_with_json():
@@ -201,7 +201,7 @@ def test_build_response_jsonp_with_json():
     assert isinstance(resp, FakeResponse)
     assert resp.status == 200
     assert resp.output == 'test.func({})'
-    assert resp.content_type == 'application/javascript'
+    assert resp.content_type == 'application/javascript; charset=utf-8'
 
 
 def test_build_response_jsonp_without_json():
@@ -270,7 +270,7 @@ class TestStatusEndpoint:
 
         assert isinstance(resp, FakeResponse)
         assert resp.status == 200
-        assert resp.content_type == 'application/json'
+        assert resp.content_type == 'application/json; charset=utf-8'
 
 
     @pytest.mark.asyncio
@@ -508,9 +508,8 @@ class TestSearchEndPointSearch:
         a.params['q'] = 'something'
         a.params['city'] = 'ignored'
 
-        res = await glue.search_endpoint(napi.NominatimAPIAsync(Path('/invalid')), a)
-
-        assert len(json.loads(res.output)) == 1
+        with pytest.raises(FakeError, match='^400 -- .*cannot be used together'):
+            res = await glue.search_endpoint(napi.NominatimAPIAsync(Path('/invalid')), a)
 
 
     @pytest.mark.asyncio