Пример #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]
Пример #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]
Пример #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
Пример #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]
Пример #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]
Пример #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