attachments.py 文件源码

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

项目:mercure 作者: synhack 项目源码 文件源码
def test_build_invalid_zip(self):
        attachment_name = 'build.json'
        attachment_path = os.path.join(settings.MEDIA_ROOT, 'test_attachment')
        copyfile(os.path.join(FILES_PATH, 'invalid_archive.zip'),
                 attachment_path)
        attachment = Attachment(
            name=attachment_name,
            buildable=True
        )
        attachment.file = os.path.join('..', attachment_path)
        attachment.save()

        kwargs = {
            'key': TRACKER_ATTACHMENT_EXECUTED,
            'campaign_id': 1,
            'target_id': 1,
            'value': 'tracker: not opened',
        }
        tracker = Tracker.objects.create(**kwargs)
        with self.assertRaises(SuspiciousOperation):
            attachment.build(tracker)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号