Пример #1
0
    def test_set(self):
        target = HttpResponse.from_status(HTTPStatus.OK, {'foo': 1})
        target['foo'] = 2

        assert target.headers == {'foo': 2}
Пример #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
Пример #3
0
    def test_get(self):
        target = HttpResponse.from_status(HTTPStatus.OK, {'foo': 1})

        assert target['foo'] == 1
Пример #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'}