Skip to content
Permalink
main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
import unittest
from Encode_Image_Using_LSB import encode_image_with_text
from Decode_Image import decode_image
class MyTestCase(unittest.TestCase):
def test_imageEncode(self):
# Valid case
self.assertEqual(encode_image_with_text('cat.png', 'Testing Image Encode'), 'Image encoded successfully. '
'Encoded image saved as: '
'cat_encoded.png')
# Invalid Case - File not present
self.assertEqual(encode_image_with_text('unknown.png', 'Testing Image Encode'), 'Invalid image file.')
def test_imageDecode(self):
# Invalid case
self.assertEqual(decode_image('cat.png'),
'The image has not been tampered and there is no hidden text in the image.')
self.assertEqual(decode_image('unknown.png'), 'Invalid image file.')
# Valid Case
self.assertEqual(decode_image('cat_encoded.png'),
'The image has been tampered and a text has been encoded in it. The Hidden Text is: Testing '
'Image Encode')
if __name__ == '__main__':
unittest.main()