def test_is_included_by_extension(self): avt = AmavisVT(AmavisVTConfigurationParser()) for ext in [ ".exe", ".com", ".bat", ".cmd", ".tar.gz", ".zip", ".tar.bz2", ".tar.7z", ".doc", ".docx", ".docm", ".xls", ".xlsa", ".xlsx", ".xlsm", ".ppt", ".ppta", ".pptx", ".pptm", ".pdf", ".js", ".rtf", ".ttf", ".htm", ".html", ".vbs", ".wsf", "", ]: assert avt.is_included(DummyResource("/tmp/foo%s" % ext)), "Extension '%s' should be included" % ext
def test_is_included_by_extension(self): avt = AmavisVT(AmavisVTConfigurationParser()) for ext in [ '.exe', '.com', '.bat', '.cmd', '.tar.gz', '.zip', '.tar.bz2', '.tar.7z', '.doc', '.docx', '.docm', '.xls', '.xlsa', '.xlsx', '.xlsm', '.ppt', '.ppta', '.pptx', '.pptm', '.pdf', '.js', '.rtf', '.ttf', '.htm', '.html', '.vbs', '.wsf', '' ]: assert avt.is_included(DummyResource( '/tmp/foo%s' % ext)), "Extension '%s' should be included" % ext
def test_is_included_by_mime_type(self): avt = AmavisVT(AmavisVTConfigurationParser()) assert avt.is_included(DummyResource(filename="foo.bar", mime_type="application/octet-stream")) assert avt.is_included(DummyResource(filename="foo.bar", mime_type="application/foobar")) assert avt.is_included(DummyResource(filename="foo.bar", mime_type="text/x-shellscript")) assert avt.is_included(DummyResource(filename="foo.bar", mime_type="text/x-perl")) assert avt.is_included(DummyResource(filename="foo.bar", mime_type="text/x-ruby")) assert avt.is_included(DummyResource(filename="foo.bar", mime_type="text/x-python")) assert not avt.is_included(DummyResource(filename="foo.bar", mime_type="text/plain")) assert not avt.is_included(DummyResource(filename="foo.bar", mime_type="message/rfc822")) assert not avt.is_included(DummyResource(filename="foo.bar", mime_type="image/png"))
def test_is_included_by_mime_type(self): avt = AmavisVT(AmavisVTConfigurationParser()) assert avt.is_included( DummyResource(filename='foo.bar', mime_type='application/octet-stream')) assert avt.is_included( DummyResource(filename='foo.bar', mime_type='application/foobar')) assert avt.is_included( DummyResource(filename='foo.bar', mime_type='text/x-shellscript')) assert avt.is_included( DummyResource(filename='foo.bar', mime_type='text/x-perl')) assert avt.is_included( DummyResource(filename='foo.bar', mime_type='text/x-ruby')) assert avt.is_included( DummyResource(filename='foo.bar', mime_type='text/x-python')) assert not avt.is_included( DummyResource(filename='foo.bar', mime_type='text/plain')) assert not avt.is_included( DummyResource(filename='foo.bar', mime_type='message/rfc822')) assert not avt.is_included( DummyResource(filename='foo.bar', mime_type='image/png'))