mirror of
https://github.com/cedricbonhomme/Stegano.git
synced 2025-05-12 17:18:30 +02:00
Updated tests for lsb
This commit is contained in:
parent
fef2040fca
commit
031e1ca84c
2 changed files with 18 additions and 2 deletions
|
@ -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()
|
||||
|
|
|
@ -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")
|
||||
|
|
Loading…
Add table
Reference in a new issue