def test_set_content_correctly(req_params): req_params['content'] = OrderedDict() req = Request(**req_params) new_data = b'new-data' assert not req.content req.content = new_data assert req.content == new_data assert req.headers['Content-Length'] == str(len(new_data))
def test_auth_malformed(defconfig): request = Request('GET', '/authorize') request.content = b'<this is not json>' request.sign() resp = request.send() assert resp.status == 400