diff options
author | Patrick Maia and Victor Shyba <pixelated-team+pmaia+vshyba@thoughtworks.com> | 2014-10-27 15:25:45 -0300 |
---|---|---|
committer | Patrick Maia and Victor Shyba <pixelated-team+pmaia+vshyba@thoughtworks.com> | 2014-10-27 15:25:45 -0300 |
commit | de8a7b14014abc895b7a9c2e8de19bc5bbc3c818 (patch) | |
tree | 45412854c4259978ee4ac74e35187a9e50430308 /service/test/unit/adapter | |
parent | 3f7c5fd9a9506957b722a47f2fbdb7e587654823 (diff) |
Card #30 - does no crash when a part does not have headers
Diffstat (limited to 'service/test/unit/adapter')
-rw-r--r-- | service/test/unit/adapter/soledad_querier_test.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/service/test/unit/adapter/soledad_querier_test.py b/service/test/unit/adapter/soledad_querier_test.py index 87ed5512..c63a3962 100644 --- a/service/test/unit/adapter/soledad_querier_test.py +++ b/service/test/unit/adapter/soledad_querier_test.py @@ -52,3 +52,15 @@ class SoledadQuerierTest(unittest.TestCase): self.assertIn('headers', attachment) self.assertIn('ident', attachment) self.assertIn('name', attachment) + + def test_extract_part_without_headers(self): + soledad = mock() + bdoc = mock() + bdoc.content = {'raw': 'esse papo seu ta qualquer coisa'} + when(soledad).get_from_index('by-type-and-payloadhash', 'cnt', any(unicode)).thenReturn([bdoc]) + hdoc = {'multi': True, 'part_map': {'1': {'multi': False, 'phash': u'0400BEBACAFE'}}} + querier = SoledadQuerier(soledad) + + parts = querier._extract_parts(hdoc) + + self.assertEquals(bdoc.content['raw'], parts['alternatives'][0]['content']) |