Updated tests for lsb

This commit is contained in:
Cédric Bonhomme 2016-05-26 07:32:35 +02:00
parent fef2040fca
commit 031e1ca84c
No known key found for this signature in database
GPG key ID: A1CB94DE57B7A70D
2 changed files with 18 additions and 2 deletions

View file

@ -63,6 +63,17 @@ class TestEXIFHeader(unittest.TestCase):
self.assertEqual(b"", clear_message)
def test_with_text_file(self):
text_file_to_hide = "./tests/sample-files/lorem_ipsum.txt"
with open(text_file_to_hide, "rb") as f:
message = f.read()
secret = exifHeader.hide("./tests/sample-files/Elisha-Cuthbert.jpg",
img_enc="./image.jpg",
secret_file=text_file_to_hide)
clear_message = exifHeader.reveal("./image.jpg")
self.assertEqual(message, clear_message)
def test_with_png_image(self):
secret = exifHeader.hide("./tests/sample-files/Lenna.png",
"./image.png", secret_message="Secret")
@ -76,6 +87,10 @@ class TestEXIFHeader(unittest.TestCase):
os.unlink("./image.jpg")
except:
pass
try:
os.unlink("./image.png")
except:
pass
if __name__ == '__main__':
unittest.main()

View file

@ -49,8 +49,9 @@ class TestLSB(unittest.TestCase):
self.assertEqual(message, clear_message)
def test_with_long_message(self):
with open("./tests/sample-files/lorem_ipsum.txt") as f:
def test_with_text_file(self):
text_file_to_hide = "./tests/sample-files/lorem_ipsum.txt"
with open(text_file_to_hide) as f:
message = f.read()
secret = lsb.hide("./tests/sample-files/Lenna.png", message)
secret.save("./image.png")