Skip to content

Commit

Permalink
test-cases for non-origin url_base
Browse files Browse the repository at this point in the history
  • Loading branch information
igorji authored Mar 29, 2019
1 parent f646100 commit 734da9a
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/suite_sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,24 @@ def test_remote_api_build_url_with_prefix(prefix, url_path, expected):
assert_that(session._build_url(url_path), is_(equal_to(expected)))


@pytest.mark.parametrize(
'base, prefix, url_path, expected',
[
('http://localhost:5000/api', 'prefix', 'test/', 'http://localhost:5000/api/prefix/test/'),
('http://localhost:5000/api', 'prefix/', 'test', 'http://localhost:5000/api/prefix/test'),
('http://localhost:5000/api', '/prefix', 'test/', 'http://localhost:5000/api/prefix/test/'),
('http://localhost:5000/api', '/prefix/', 'test', 'http://localhost:5000/api/prefix/test'),
('http://localhost:5000/api/', 'prefix', 'test/', 'http://localhost:5000/api/prefix/test/'),
('http://localhost:5000/api/', 'prefix/', 'test', 'http://localhost:5000/api/prefix/test'),
('http://localhost:5000/api/', '/prefix', 'test/', 'http://localhost:5000/api/prefix/test/'),
('http://localhost:5000/api/', '/prefix/', 'test', 'http://localhost:5000/api/prefix/test'),
],
)
def test_remote_api_build_url_with_prefix_and_nonorigin_base(base, prefix, url_path, expected):
session = RemoteApiSession(base, prefix=prefix)
assert_that(session._build_url(url_path), is_(equal_to(expected)))


def test_serializable():
base_url = 'http://test.ru'
prefix = '/prefix'
Expand Down

0 comments on commit 734da9a

Please sign in to comment.