Exemplo n.º 1
0
    def test_search_with_parameters(self, mock_search):
        voicemails = Mock(SearchResult)
        mock_search.return_value = voicemails

        result = voicemail_services.search(skip=1,
                                           limit=2,
                                           order='number',
                                           direction='asc',
                                           search='toto')

        mock_search.assert_called_once_with(skip=1,
                                            limit=2,
                                            order='number',
                                            direction='asc',
                                            search='toto')

        self.assertEquals(result, voicemails)
Exemplo n.º 2
0
def list():
    search_parameters = extract_search_parameters(request.args)
    search_result = voicemail_services.search(**search_parameters)
    result = formatter.list_to_api(search_result.items, search_result.total)
    return make_response(result, 200)