test_models.py 文件源码

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

项目:cyphon 作者: dunbarcyber 项目源码 文件源码
def test_get_blind_sample(self):
        """
        Tests the get_sample method.
        """
        codebook = CodeBook.objects.get_by_natural_key('Acme')
        with patch.dict('teasers.models.settings.TEASERS',
                        self.mock_teaser_settings):
            with patch.dict('codebooks.models.settings.CODEBOOKS',
                            self.mock_codebooks_settings):
                actual = self.teaser.get_blind_sample(self.data, codebook)
                location = actual.pop('location')
                expected = {
                    'collection': 'elasticsearch.test_index.acme',
                    'author': '*FORGE*',
                    'title': '*PEAK* & *',
                    'content': 12345678910123,
                    'date': self.now,
                }
                self.assertEqual(actual, expected)
                self.assertEqual(location.coords, (-148.000, 32.000))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号