test_attachments.py 文件源码

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

项目:cyphon 作者: dunbarcyber 项目源码 文件源码
def test_allowed_file(self):
        """
        Tests the get_file_path function for an allowed file type.
        """
        self.msg.attach(self.image)
        attachment = get_first_attachment(self.msg)
        mock_uuid = Mock()
        mock_uuid.hex = self.uuid
        with patch('sifter.mailsifter.attachments.uuid.uuid4',
                   return_value=mock_uuid):
            with patch.dict('sifter.mailsifter.attachments.settings.MAILSIFTER',
                            self.mock_mailsifter_settings):
                actual = attachments.get_file_path(attachment, self.company)
                expected = '%s/test-attachments/%s.jpeg' \
                           % (self.company.uuid.hex, self.uuid)
                self.assertEqual(actual, expected)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号