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))
评论列表
文章目录