Skip to content

Commit

Permalink
Merge pull request #1605 from svahul/response_code_param_url
Browse files Browse the repository at this point in the history
response code for parameter "url"
  • Loading branch information
svamaa authored Sep 22, 2022
2 parents d0ba6e3 + 71719a7 commit 0aac2d7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
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'

0 comments on commit 0aac2d7

Please sign in to comment.