def get_comments(item_id): """Return story with its comments""" try: resp = items.get_comments(item_id) except exceptions.NotFound: abort(404) return app.response_class(resp, mimetype='application/json')
def test_get_comments(self): with mock.patch.object(items, '_get_cache') as get_cache: items.get_comments('test_item') get_cache.assert_called_with('/comments/test_item', 'item?id=test_item')