Skip to content

Commit

Permalink
Cleaned up unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ragusaa committed Jun 13, 2024
1 parent 9c2a695 commit 7527650
Showing 1 changed file with 29 additions and 58 deletions.
87 changes: 29 additions & 58 deletions unit_tests/clamscan/ole2_encryption_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import sys
import os
import re
import shutil

sys.path.append('../unit_tests')
import testcase
Expand Down Expand Up @@ -82,10 +83,8 @@ def test_FAT_doc_metadata(self):

assert output.ec == 0 # clean

expected_strings = [
'"Encrypted":1',
]
self.assertStrings(tempdir, neededStrings)
expected_strings = [ '"Encrypted":"ENCRYPTION_TYPE_UNKNOWN"' ]
self.verify_metadata_json(tempdir, expected_strings)

def test_ministream_doc(self):
self.step_name('Test ministream doc')
Expand Down Expand Up @@ -123,10 +122,8 @@ def test_ministream_doc_metadata(self):

assert output.ec == 0 # clean

neededStrings = [ '"Encrypted":1'
, '"EncryptedWithVelvetSweatshop":0'
]
self.assertStrings(tempdir, neededStrings)
expected_strings = [ '"Encrypted":"ENCRYPTION_TYPE_UNKNOWN"' ]
self.verify_metadata_json(tempdir, expected_strings)


def test_FAT_docx(self):
Expand Down Expand Up @@ -165,10 +162,8 @@ def test_FAT_docx_metadata(self):

assert output.ec == 0 # clean

neededStrings = [ '"Encrypted":1'
, '"EncryptedWithVelvetSweatshop":0'
]
self.assertStrings(tempdir, neededStrings)
expected_strings = [ '"Encrypted":"ENCRYPTION_TYPE_UNKNOWN"' ]
self.verify_metadata_json(tempdir, expected_strings)

def test_ministream_docx(self):
self.step_name('Test ministream docx')
Expand Down Expand Up @@ -206,10 +201,8 @@ def test_ministream_docx_metadata(self):

assert output.ec == 0 # clean

neededStrings = [ '"Encrypted":1'
, '"EncryptedWithVelvetSweatshop":0'
]
self.assertStrings(tempdir, neededStrings)
expected_strings = [ '"Encrypted":"ENCRYPTION_TYPE_UNKNOWN"' ]
self.verify_metadata_json(tempdir, expected_strings)

def test_FAT_dot(self):
self.step_name('Test FAT dot')
Expand Down Expand Up @@ -247,10 +240,8 @@ def test_FAT_dot_metadata(self):

assert output.ec == 0 # clean

neededStrings = [ '"Encrypted":1'
, '"EncryptedWithVelvetSweatshop":0'
]
self.assertStrings(tempdir, neededStrings)
expected_strings = [ '"Encrypted":"ENCRYPTION_TYPE_UNKNOWN"' ]
self.verify_metadata_json(tempdir, expected_strings)

def test_ministream_dot(self):
self.step_name('Test ministream dot')
Expand Down Expand Up @@ -288,10 +279,8 @@ def test_ministream_dot_metadata(self):

assert output.ec == 0 # clean

neededStrings = [ '"Encrypted":1'
, '"EncryptedWithVelvetSweatshop":0'
]
self.assertStrings(tempdir, neededStrings)
expected_strings = [ '"Encrypted":"ENCRYPTION_TYPE_UNKNOWN"' ]
self.verify_metadata_json(tempdir, expected_strings)

def test_FAT_ppsx(self):
self.step_name('Test FAT ppsx')
Expand Down Expand Up @@ -329,10 +318,8 @@ def test_FAT_ppsx_metadata(self):

assert output.ec == 0 # clean

neededStrings = [ '"Encrypted":1'
, '"EncryptedWithVelvetSweatshop":0'
]
self.assertStrings(tempdir, neededStrings)
expected_strings = [ '"Encrypted":"ENCRYPTION_TYPE_UNKNOWN"' ]
self.verify_metadata_json(tempdir, expected_strings)

def test_ministream_ppsx(self):
self.step_name('Test ministream ppsx')
Expand Down Expand Up @@ -370,10 +357,8 @@ def test_ministream_ppsx_metadata(self):

assert output.ec == 0 # clean

neededStrings = [ '"Encrypted":1'
, '"EncryptedWithVelvetSweatshop":0'
]
self.assertStrings(tempdir, neededStrings)
expected_strings = [ '"Encrypted":"ENCRYPTION_TYPE_UNKNOWN"' ]
self.verify_metadata_json(tempdir, expected_strings)

def test_FAT_pptx(self):
self.step_name('Test FAT pptx')
Expand Down Expand Up @@ -411,10 +396,8 @@ def test_FAT_pptx_metadata(self):

assert output.ec == 0 # clean

neededStrings = [ '"Encrypted":1'
, '"EncryptedWithVelvetSweatshop":0'
]
self.assertStrings(tempdir, neededStrings)
expected_strings = [ '"Encrypted":"ENCRYPTION_TYPE_UNKNOWN"' ]
self.verify_metadata_json(tempdir, expected_strings)

def test_ministream_pptx(self):
self.step_name('Test ministream pptx')
Expand Down Expand Up @@ -452,10 +435,8 @@ def test_ministream_pptx_metadata(self):

assert output.ec == 0 # clean

neededStrings = [ '"Encrypted":1'
, '"EncryptedWithVelvetSweatshop":0'
]
self.assertStrings(tempdir, neededStrings)
expected_strings = [ '"Encrypted":"ENCRYPTION_TYPE_UNKNOWN"' ]
self.verify_metadata_json(tempdir, expected_strings)

def test_FAT_xls(self):
self.step_name('Test FAT xls')
Expand Down Expand Up @@ -493,11 +474,8 @@ def test_FAT_xls_metadata(self):

assert output.ec == 0 # clean

neededStrings = [ '"Encrypted":1'
, '"EncryptedWithVelvetSweatshop":0'
, '"RC4Encryption":1'
]
self.assertStrings(tempdir, neededStrings)
expected_strings = [ '"Encrypted":"RC4"' ]
self.verify_metadata_json(tempdir, expected_strings)

def test_ministream_xls(self):
self.step_name('Test ministream xls')
Expand Down Expand Up @@ -535,11 +513,8 @@ def test_ministream_xls_metadata(self):

assert output.ec == 0 # clean

neededStrings = [ '"Encrypted":1'
, '"EncryptedWithVelvetSweatshop":0'
, '"RC4Encryption":1'
]
self.assertStrings(tempdir, neededStrings)
expected_strings = [ '"Encrypted":"RC4"' ]
self.verify_metadata_json(tempdir, expected_strings)

def test_FAT_xlsx(self):
self.step_name('Test FAT xlsx')
Expand Down Expand Up @@ -577,10 +552,8 @@ def test_FAT_xlsx_metadata(self):

assert output.ec == 0 # clean

neededStrings = [ '"Encrypted":1'
, '"EncryptedWithVelvetSweatshop":0'
]
self.assertStrings(tempdir, neededStrings)
expected_strings = [ '"Encrypted":"ENCRYPTION_TYPE_UNKNOWN"' ]
self.verify_metadata_json(tempdir, expected_strings)

def test_ministream_xlsx(self):
self.step_name('Test ministream xlsx')
Expand Down Expand Up @@ -618,10 +591,8 @@ def test_ministream_xlsx_metadata(self):

assert output.ec == 0 # clean

neededStrings = [ '"Encrypted":1'
, '"EncryptedWithVelvetSweatshop":0'
]
self.assertStrings(tempdir, neededStrings)
expected_strings = [ '"Encrypted":"ENCRYPTION_TYPE_UNKNOWN"' ]
self.verify_metadata_json(tempdir, expected_strings)



Expand Down

0 comments on commit 7527650

Please sign in to comment.