diff --git a/tests/test_maps_cells.py b/tests/test_maps_cells.py index d7ee39c0..d74570a1 100644 --- a/tests/test_maps_cells.py +++ b/tests/test_maps_cells.py @@ -202,7 +202,7 @@ def test_get_geojson(app, layer, user): json=lambda: json.loads(SAMPLE_GEOJSON_CONTENT), status_code=200) resp = app.get(reverse('mapcell-geojson', kwargs={'cell_id': cell.id})) - assert len(json.loads(resp.content)['features']) == 2 + assert len(json.loads(resp.text)['features']) == 2 assert requests_get.call_count == 1 resp = app.get(reverse('mapcell-geojson', kwargs={'cell_id': cell.id})) assert requests_get.call_count == 1 # cache was used @@ -257,17 +257,17 @@ def test_get_geojson(app, layer, user): json=lambda: json.loads(SAMPLE_GEOJSON_CONTENT), status_code=200) resp = app.get(reverse('mapcell-geojson', kwargs={'cell_id': cell.id}) + '?q=bar') - assert len(json.loads(resp.content)['features']) == 1 + assert len(json.loads(resp.text)['features']) == 1 assert 'orig=combo' in requests_get.call_args[0][1] assert not 'email=admin%40localhost&' in requests_get.call_args[0][1] # query against layer name resp = app.get(reverse('mapcell-geojson', kwargs={'cell_id': cell.id}) + '?q=bicycle') - assert len(json.loads(resp.content)['features']) == 0 + assert len(json.loads(resp.text)['features']) == 0 # query against subproperty resp = app.get(reverse('mapcell-geojson', kwargs={'cell_id': cell.id}) + '?q=whatever') - assert len(json.loads(resp.content)['features']) == 1 + assert len(json.loads(resp.text)['features']) == 1 # check distance query on geojson layer.geojson_url = 'http://example.org/geojson?t6' @@ -279,13 +279,13 @@ def test_get_geojson(app, layer, user): json=lambda: json.loads(SAMPLE_GEOJSON_CONTENT), status_code=200) resp = app.get(reverse('mapcell-geojson', kwargs={'cell_id': cell.id}) + '?lng=2.54&lat=48.84&distance=2000') - assert len(json.loads(resp.content)['features']) == 2 + assert len(json.loads(resp.text)['features']) == 2 resp = app.get(reverse('mapcell-geojson', kwargs={'cell_id': cell.id}) + '?lng=2.54&lat=48.84&distance=1000') - assert len(json.loads(resp.content)['features']) == 1 + assert len(json.loads(resp.text)['features']) == 1 resp = app.get(reverse('mapcell-geojson', kwargs={'cell_id': cell.id}) + '?lng=2.54&lat=48.84&distance=100') - assert len(json.loads(resp.content)['features']) == 0 + assert len(json.loads(resp.text)['features']) == 0 # check on multiple words with mock.patch('combo.utils.requests_wrapper.RequestsSession.request') as requests_get: @@ -294,10 +294,10 @@ def test_get_geojson(app, layer, user): json=lambda: json.loads(SAMPLE_GEOJSON_CONTENT), status_code=200) resp = app.get(reverse('mapcell-geojson', kwargs={'cell_id': cell.id}) + '?q=bar baz') - assert len(json.loads(resp.content)['features']) == 1 + assert len(json.loads(resp.text)['features']) == 1 resp = app.get(reverse('mapcell-geojson', kwargs={'cell_id': cell.id}) + '?q=quux baz') - assert len(json.loads(resp.content)['features']) == 0 + assert len(json.loads(resp.text)['features']) == 0 # add a second layer layer2 = MapLayer() @@ -315,20 +315,20 @@ def test_get_geojson(app, layer, user): json=lambda: json.loads(SAMPLE_GEOJSON_CONTENT), status_code=200) resp = app.get(reverse('mapcell-geojson', kwargs={'cell_id': cell.id}) + '?q=bar') - assert len(json.loads(resp.content)['features']) == 2 + assert len(json.loads(resp.text)['features']) == 2 resp = app.get(reverse('mapcell-geojson', kwargs={'cell_id': cell.id}) + '?q=xyz') - assert len(json.loads(resp.content)['features']) == 0 + assert len(json.loads(resp.text)['features']) == 0 # query against layer name, it should get results resp = app.get(reverse('mapcell-geojson', kwargs={'cell_id': cell.id}) + '?q=bicycle') - assert len(json.loads(resp.content)['features']) == 2 + assert len(json.loads(resp.text)['features']) == 2 resp = app.get(reverse('mapcell-geojson', kwargs={'cell_id': cell.id}) + '?q=bar bicycle') - assert len(json.loads(resp.content)['features']) == 1 + assert len(json.loads(resp.text)['features']) == 1 resp = app.get(reverse('mapcell-geojson', kwargs={'cell_id': cell.id}) + '?q=quux bicycle') - assert len(json.loads(resp.content)['features']) == 0 + assert len(json.loads(resp.text)['features']) == 0 def test_get_geojson_properties(app, layer, user): @@ -348,7 +348,7 @@ def test_get_geojson_properties(app, layer, user): json=lambda: json.loads(SAMPLE_GEOJSON_CONTENT), status_code=200) resp = app.get(reverse('mapcell-geojson', kwargs={'cell_id': cell.id})) - features = json.loads(resp.content)['features'] + features = json.loads(resp.text)['features'] assert 'name' in features[0]['properties'] assert 'extra' in features[0]['properties'] assert features[0]['properties']['layer']['properties'] == [] @@ -362,7 +362,7 @@ def test_get_geojson_properties(app, layer, user): json=lambda: json.loads(SAMPLE_GEOJSON_CONTENT), status_code=200) resp = app.get(reverse('mapcell-geojson', kwargs={'cell_id': cell.id})) - features = json.loads(resp.content)['features'] + features = json.loads(resp.text)['features'] assert 'name' in features[0]['properties'] assert 'extra' not in features[0]['properties'] assert features[0]['properties']['layer']['properties'] == ['name', 'hop'] @@ -376,7 +376,7 @@ def test_get_geojson_properties(app, layer, user): json=lambda: json.loads(SAMPLE_WCS_GEOJSON_CONTENT), status_code=200) resp = app.get(reverse('mapcell-geojson', kwargs={'cell_id': cell.id})) - features = json.loads(resp.content)['features'] + features = json.loads(resp.text)['features'] assert len(features[0]['properties']['display_fields']) == 2 assert features[0]['properties']['layer']['properties'] == [] @@ -389,6 +389,6 @@ def test_get_geojson_properties(app, layer, user): json=lambda: json.loads(SAMPLE_WCS_GEOJSON_CONTENT), status_code=200) resp = app.get(reverse('mapcell-geojson', kwargs={'cell_id': cell.id})) - features = json.loads(resp.content)['features'] + features = json.loads(resp.text)['features'] assert len(features[0]['properties']['display_fields']) == 1 assert features[0]['properties']['layer']['properties'] == ['id']