Ejemplo n.º 1
0
    def test_set(self):
        target = HttpResponse.from_status(HTTPStatus.OK, {'foo': 1})
        target['foo'] = 2

        assert target.headers == {'foo': 2}
Ejemplo n.º 2
0
    def test_from_status(self, args, body, status, headers):
        target = HttpResponse.from_status(*args)

        assert target.body == body
        assert target.status == status
        assert target.headers == headers
Ejemplo n.º 3
0
    def test_get(self):
        target = HttpResponse.from_status(HTTPStatus.OK, {'foo': 1})

        assert target['foo'] == 1
Ejemplo n.º 4
0
    def test_set_content_type(self):
        target = HttpResponse.from_status(HTTPStatus.OK)
        target.set_content_type('text/html')

        assert target.headers == {'Content-Type': 'text/html'}