test_distillery_search_results.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:cyphon 作者: dunbarcyber 项目源码 文件源码
def test_as_dict(self):
        """
        Tests that the as_dict() function returns the correct
        dictionary shape.
        """
        search_query = SearchQuery('@source=test_database.test_posts test')
        distillery_results_list = self._get_instance(search_query)
        factory = RequestFactory()
        request = factory.get('/api/v1/search/')

        self.assertEqual(distillery_results_list.as_dict(request), {
            'count': 1,
            'results': [{
                'count': 1,
                'next': None,
                'previous': None,
                'results': MOCK_RESULTS_LIST,
                'distillery': {
                    'id': 1,
                    'name': 'mongodb.test_database.test_posts',
                    'url': 'http://testserver/api/v1/distilleries/1/',
                }
            }]
        })
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号