def test_dummy_static_with_article_id_two_att_ignore_content(self): self.maxDiff = None att1 = Attachment.create_basic("mFyCg==", "text/plain", "foo.txt") att2 = Attachment.create_basic("YmFyCg==", "text/plain", "dümmy.txt") art = Article({"Subject": "Dümmy Subject", "Body": "Hallo Bjørn,\n[kt]\n\n -- The End", "ArticleID": 4, "TimeUnit": 0, "MimeType": "text/plain", "Charset": "UTF8"}) art.attachments = [att1, att2] expected = {'Subject': 'Dümmy Subject', 'Body': 'Hallo Bjørn,\n[kt]\n\n -- The End', 'ArticleID': 4, 'TimeUnit': 0, 'MimeType': 'text/plain', 'Charset': 'UTF8', 'Attachment': [{'ContentType': 'text/plain', 'Filename': 'foo.txt'}, {'ContentType': 'text/plain', 'Filename': 'dümmy.txt'}]} self.assertDictEqual(art.to_dct(attachment_cont=False), expected) self.assertEqual(art.__repr__(), "<ArticleID: 4 (2 Attachments)>")
def test_dummy_static_with_article_id_one_att(self): self.maxDiff = None att = Attachment.create_basic("mFyCg==", "text/plain", "foo.txt") art = Article({"Subject": "Dümmy Subject", "Body": "Hallo Bjørn,\n[kt]\n\n -- The End", "ArticleID": 3, "TimeUnit": 0, "MimeType": "text/plain", "Charset": "UTF8"}) art.attachments = [att] expected = {'Subject': 'Dümmy Subject', 'Body': 'Hallo Bjørn,\n[kt]\n\n -- The End', 'ArticleID': 3, 'TimeUnit': 0, 'MimeType': 'text/plain', 'Charset': 'UTF8', 'Attachment': [{'Content': 'mFyCg==', 'ContentType': 'text/plain', 'Filename': 'foo.txt'}]} self.assertDictEqual(art.to_dct(), expected) self.assertEqual(art.__repr__(), "<ArticleID: 3 (1 Attachment)>")