Пример #1
0
def test_build_url():
    api = Legistar("test")
    url = api._build_url("body", 42)
    expected = "https://webapi.legistar.com/v1/test/body/42"
    assert url == expected
Пример #2
0
def test_build_url_with_method_params():
    api = Legistar("test")
    url = api._build_url("events", 42, eventitems=0)
    expected = "https://webapi.legistar.com/v1/test/events/42?eventitems=0"
    assert url == expected
Пример #3
0
def test_build_url_with_both_params():
    token = "9DdUbDYWLdZPl9DreGrupLvpl5MRWjjK"
    api = Legistar("test", url_params={"token": token})
    url = api._build_url("events", 42, eventitems=0)
    expected = "https://webapi.legistar.com/v1/test/events/42?eventitems=0&token=9DdUbDYWLdZPl9DreGrupLvpl5MRWjjK"
    assert url == expected
Пример #4
0
def test_build_url_with_class_params():
    token = "9DdUbDYWLdZPl9DreGrupLvpl5MRWjjK"
    api = Legistar("test", url_params={"token": token})
    url = api._build_url("body", 42)
    expected = "https://webapi.legistar.com/v1/test/body/42?token=9DdUbDYWLdZPl9DreGrupLvpl5MRWjjK"
    assert url == expected