Esempio n. 1
0
def test_can_use_resource_with_template_uri():
    resource_tmpl = ResourceTemplate("http://localhost:8080/person/{name}")
    for name in PEOPLE.keys():
        with resource_tmpl.expand(name=name).get() as response:
            assert isinstance(response, JSONResponse)
            assert assembled(response) == PEOPLE[name]
Esempio n. 2
0
def test_can_get_multi_object_json_resource():
    resource = Resource("http://localhost:8080/person/")
    with resource.get() as response:
        assert isinstance(response, JSONResponse)
        for (name,), person in grouped(response):
            assert assembled(person) == PEOPLE[name]
Esempio n. 3
0
def test_can_get_simple_json_resource():
    resource = Resource("http://localhost:8080/object")
    with resource.get() as response:
        assert isinstance(response, JSONResponse)
        assert assembled(response) == OBJECT
Esempio n. 4
0
def test_can_use_resource_with_template_uri():
    resource_tmpl = ResourceTemplate("http://localhost:8080/person/{name}")
    for name in PEOPLE.keys():
        with resource_tmpl.expand(name=name).get() as response:
            assert isinstance(response, JSONResponse)
            assert assembled(response) == PEOPLE[name]
Esempio n. 5
0
def test_can_get_multi_object_json_resource():
    resource = Resource("http://localhost:8080/person/")
    with resource.get() as response:
        assert isinstance(response, JSONResponse)
        for (name,), person in grouped(response):
            assert assembled(person) == PEOPLE[name]
Esempio n. 6
0
def test_can_get_simple_json_resource():
    resource = Resource("http://localhost:8080/object")
    with resource.get() as response:
        assert isinstance(response, JSONResponse)
        assert assembled(response) == OBJECT