Skip to content

Commit

Permalink
Unit test for get_x_forwarded_prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
index-git committed Sep 21, 2023
1 parent 69b9fea commit 1ba38bf
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/layman/util_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,12 @@ def test__url_for(endpoint, internal, params, expected_url):
# pylint: disable=protected-access
assert util._url_for(endpoint, server_name=server_name, proxy_server_name=proxy_server_name, internal=internal,
**params) == expected_url


@pytest.mark.parametrize('headers, exp_result', [
pytest.param({'X-Forwarded-Prefix': '/layman-proxy'}, '/layman-proxy', id='simple_header'),
pytest.param({}, None, id='without_header'),
])
def test_get_x_forwarded_prefix(headers, exp_result):
result = util.get_x_forwarded_prefix(headers)
assert result == exp_result

0 comments on commit 1ba38bf

Please sign in to comment.