def test_forbidden_error1(): s = HttpServer() with pytest.raises(ForbiddenError): body, content_type = s._retrieve_resource(b"../../etc/password/")
def test_retrieve_resources_2(): s = HttpServer() with pytest.raises(ResourceNotFound): s._retrieve_resource(b"afilethatdoesntexist.123")
def test_retrieve_resources_3(): s = HttpServer() body, content_type = s._retrieve_resource(b"") assert content_type == b"text/html"
def test_retrieve_resource_1(): test_string = u"Here is text with some unicode in it: ÄÄÄÄÄÄÄÄÄÄ" s = HttpServer() body, content_type = s._retrieve_resource(b"test.html") assert content_type == b"text/html" assert body.decode('utf-8') == test_string