Exemplo n.º 1
0
def test_url_comparison():
    url_a = Url("https://example.org/users/{id}", id=1)
    url_b = Url("https://example.org/users/{id}", id=1)
    assert url_a == url_b

    url_a = Url("https://example.org/users/{id}", id=1)
    url_b = Url("https://example.org/users/{id}", id=2)
    assert url_a != url_b
Exemplo n.º 2
0
 def __init__(self, host, driver):
     self.url = Url(host)
     self.driver = driver
Exemplo n.º 3
0
 def __init__(self, driver: DT):
     self.url = Url("https://example.com")
     self.driver: DT = driver
Exemplo n.º 4
0
def test_url_join_path():
    url = Url("https://example.org")
    assert url("/users/{id}", id=1) == "https://example.org/users/1"

    url = Url("https://example.org")("/{version}", version="v1")("/users/{id}", id=1)
    assert url == "https://example.org/v1/users/1"
Exemplo n.º 5
0
def test_invalid_comparison():
    url = Url("https://example.org")
    assert url != 1
Exemplo n.º 6
0
def test_url_string_representation():
    url = Url("https://example.org")
    assert url == "https://example.org"

    url = Url("https://example.org/users/{id}", id=1)
    assert url == "https://example.org/users/1"
Exemplo n.º 7
0
def test_url_representation():
    url = Url("https://example.org")
    assert repr(url) == "Url('https://example.org')"

    url = Url("https://example.org/users/{id}", id=1)
    assert repr(url) == "Url('https://example.org/users/{id}', id=1)"