Updated tests.

This commit is contained in:
Cédric Bonhomme 2019-04-10 15:09:07 +02:00
parent c5b7df87f5
commit ba3cde6112
No known key found for this signature in database
GPG key ID: A1CB94DE57B7A70D
2 changed files with 28 additions and 1 deletions

View file

@ -132,7 +132,6 @@ class TestLSB(unittest.TestCase):
messages_to_hide = ["a", "foo", "Hello World!", ":Python:"]
for message in messages_to_hide:
message = "Hello World"
outputBytes = io.BytesIO()
with open("./tests/sample-files/20160505T130442.jpg", 'rb') as f:
bytes_image = lsb.hide(f, message)
@ -143,6 +142,19 @@ class TestLSB(unittest.TestCase):
self.assertEqual(message, clear_message)
def test_with_location_of_image_as_argument(self):
messages_to_hide = ["Hello World!"]
for message in messages_to_hide:
outputBytes = io.BytesIO()
bytes_image = lsb.hide("./tests/sample-files/20160505T130442.jpg", message)
bytes_image.save(outputBytes, "PNG")
outputBytes.seek(0)
clear_message = lsb.reveal(outputBytes)
self.assertEqual(message, clear_message)
def tearDown(self):
try:
os.unlink("./image.png")