Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import falcon
- import msgpack
- from falcon import testing
- import pytest
- from look.app import api
- @pytest.fixture
- def client():
- return testing.TestClient(api)
- def test_list_images(client):
- doc = {
- 'images': [
- {
- 'href': '/images/1eaf6ef1-7f2d-4ecc-a8d5-6e8adba7cc0e.png'
- }
- ]
- }
- response: falcon.testing.client.Result = client.simulate_get('/images')
- '''
- Solução do site do falcon
- Estou usando raw=False pois a lib fala que o encoding está deprecado
- result_doc = msgpack.unpackb(response.content, raw=False)
- '''
- '''
- Minha solução
- Estou usando raw=False pois a lib fala que o encoding está deprecado
- '''
- result_doc = msgpack.unpackb(msgpack.packb(response.json, use_bin_type=True), raw=False)
- assert result_doc == doc
- assert response.status == falcon.HTTP_OK
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement