Ejemplo n.º 1
0
def test_routed_path__with_uuid():
    rp = Route("test").uuid("foo")
    assert (
        rp.to_url() ==
        r"(?P<foo>[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})/$"
    )
Ejemplo n.º 2
0
def test_routed_path__with_optional_uuid():
    rp = Route("test").uuid("foo", optional=True)
    assert (
        rp.to_url() ==
        r"(?P<foo>[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})?/?$"
    )
Ejemplo n.º 3
0
def test_routed_path__with_pk():
    rp = Route("test").pk("foo")
    assert rp.to_url() == r"(?P<foo>[0-9]+)/$"
Ejemplo n.º 4
0
def test_routed_path__with_optional_pk():
    rp = Route("test").pk("foo", optional=True)
    assert rp.to_url() == r"(?P<foo>[0-9]+)?/?$"
Ejemplo n.º 5
0
def test_routed_path__with_optional_slug():
    rp = Route("test").slug("foo", optional=True)
    assert rp.to_url() == r"(?P<foo>[\-\w]+)?/?$"
Ejemplo n.º 6
0
def test_routed_path__with_slug():
    rp = Route("test").slug("foo")
    assert rp.to_url() == r"(?P<foo>[\-\w]+)/$"
Ejemplo n.º 7
0
def test_routed_path__with_path():
    rp = Route("test").path("foo")
    assert rp.to_url() == r"foo/$"
Ejemplo n.º 8
0
def test_routed_path__with_many_params():
    rp = Route("test").path("aaa").pk("bbb").path("ccc").slug("ddd")
    assert rp.to_url() == r"aaa/(?P<bbb>[0-9]+)/ccc/(?P<ddd>[\-\w]+)/$"
Ejemplo n.º 9
0
def test_routed_path__with_no_params():
    rp = Route("test")
    assert rp.to_url() == r"$"