<s> from tests import factories <EOL> def test_get_should_return_documents ( client , session ) : <EOL> documents_count = <NUM_LIT:3> <EOL> factories . DocumentFactory . create_batch ( documents_count ) <EOL> response = client . get ( '<STR_LIT>' ) <EOL> assert response . status_code == <NUM_LIT:200> <EOL> assert len ( response . json ) == documents_count <EOL> def test_get_should_return_paginated_documents ( client , session ) : <EOL> documents_count = <NUM_LIT:3> <EOL> factories . DocumentFactory . create_batch ( documents_count ) <EOL> length = <NUM_LIT:2> <EOL> start = <NUM_LIT:0> <EOL> response = client . get ( '<STR_LIT>' . format ( start , length ) ) <EOL> assert response . status_code == <NUM_LIT:200> <EOL> assert len ( response . json ) == length <EOL> def test_get_documents_should_return_404_when_missing_page ( client , session ) : <EOL> documents_count = <NUM_LIT:3> <EOL> factories . DocumentFactory . create_batch ( documents_count ) <EOL> response = client . get ( '<STR_LIT>' ) <EOL> assert response . status_code == <NUM_LIT> <EOL> assert response . json == { } <EOL> def test_get_should_return_one_document ( client , session ) : <EOL> name = '<STR_LIT>' <EOL> document = factories . DocumentFactory . create ( data = { '<STR_LIT:name>' : name } ) <EOL> response = client . get ( '<STR_LIT>' . format ( id = document . id ) ) <EOL> assert response . status_code == <NUM_LIT:200> <EOL> assert response . json [ '<STR_LIT:name>' ] == name </s>
