Skip to content

Commit

Permalink
chore(url): add test for MultiHostUrl method with extra characters
Browse files Browse the repository at this point in the history
  • Loading branch information
zoilorys committed Jan 29, 2024
1 parent 1cc3164 commit 6ef41b7
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/validators/test_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -1259,6 +1259,20 @@ def test_multi_url_build() -> None:
assert url == MultiHostUrl('postgresql://testuser:testpassword@127.0.0.1:5432/database?sslmode=require#test')
assert str(url) == 'postgresql://testuser:testpassword@127.0.0.1:5432/database?sslmode=require#test'

# assert that `build` builds correctly with leading slash in path, leading question mark in query and leading hash in fragment
url = MultiHostUrl.build(
scheme='postgresql',
username='testuser',
password='testpassword',
host='127.0.0.1',
port=5432,
path='/database',
query='?sslmode=require',
fragment='#test',
)
assert url == MultiHostUrl('postgresql://testuser:testpassword@127.0.0.1:5432/database?sslmode=require#test')
assert str(url) == 'postgresql://testuser:testpassword@127.0.0.1:5432/database?sslmode=require#test'


@pytest.mark.parametrize('field', ['host', 'password', 'username', 'port'])
def test_multi_url_build_hosts_set_with_single_value(field) -> None:
Expand Down

0 comments on commit 6ef41b7

Please sign in to comment.