Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

response code for parameter "url" #1605

Merged
merged 1 commit into from
Sep 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pyramid_oereb/core/views/webservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import io
# import re

from pyramid.httpexceptions import HTTPBadRequest, HTTPFound, HTTPInternalServerError, HTTPNoContent, \
from pyramid.httpexceptions import HTTPBadRequest, HTTPSeeOther, HTTPInternalServerError, HTTPNoContent, \
HTTPNotFound
from pyramid.path import DottedNameResolver
from shapely.geometry import Point
Expand Down Expand Up @@ -598,12 +598,12 @@ def __redirect_to_dynamic_client__(real_estate):
The found real estate.

Returns:
pyramid.httpexceptions.HTTPFound: The redirect response.
pyramid.httpexceptions.HTTPSeeOther: The redirect response.
"""
url = Config.get_extract_config().get('redirect')
if url is None:
raise HTTPInternalServerError('Missing configuration for redirect to dynamic client.')
return HTTPFound(url.format(**vars(real_estate)))
return HTTPSeeOther(url.format(**vars(real_estate)))


class Parameter(object):
Expand Down
4 changes: 2 additions & 2 deletions tests/core/webservice/test_getextractbyid.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import pytest
from unittest.mock import patch
from jsonschema import Draft4Validator
from pyramid.httpexceptions import HTTPBadRequest, HTTPFound, HTTPNoContent
from pyramid.httpexceptions import HTTPBadRequest, HTTPSeeOther, HTTPNoContent

from tests.mockrequest import MockRequest
from pyramid_oereb.core.views.webservice import PlrWebservice
Expand Down Expand Up @@ -238,5 +238,5 @@ def test_format_url(real_estate_data):
})
service = PlrWebservice(request)
response = service.get_extract_by_id()
assert isinstance(response, HTTPFound)
assert isinstance(response, HTTPSeeOther)
assert response.location == 'https://geoview.bl.ch/oereb/?egrid=TEST'