Exemplo n.º 1
0
    def test_attachment_create_from_file_no_file_ext(self):
        """create_from_file test - no file ending -> mime needs to default"""
        att = Attachment.create_from_file(os.path.join(current_path, "fixtures/b_file"))

        self.assertIsInstance(att, Attachment)
        self.assertEqual(att.ContentType, "application/octet-stream")
Exemplo n.º 2
0
    def test_attachment_create_from_binary_file(self):
        """create_from_file with binary test file"""
        att = Attachment.create_from_file(os.path.join(current_path, "fixtures/logo_bg.png"))

        self.assertIsInstance(att, Attachment)
        self.assertEqual(att.ContentType, "image/png")
Exemplo n.º 3
0
    def test_attachment_create_from_file(self):
        """create_from_file test ending in .txt"""
        att = Attachment.create_from_file(os.path.join(current_path, "fixtures/a_file.txt"))

        self.assertIsInstance(att, Attachment)
        self.assertEqual(att.ContentType, "text/plain")