-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathiptc_info_cipher_test.py
More file actions
50 lines (40 loc) · 1.85 KB
/
iptc_info_cipher_test.py
File metadata and controls
50 lines (40 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import unittest
import iptc_info_cipher
class test_iptc_info_cipher(unittest.TestCase):
def setUp(self):
return
def test_encrypt_decrypt(self):
aIC = iptc_info_cipher.IPTCInfoCipher()
input_string="Hello World"
token=aIC._fernet_encrypt(input_string,"password")
output_string=aIC._fermet_decrypt(token,"password")
self.assertTrue(input_string==output_string)
def test_print_iptcinfo(self):
aIC = iptc_info_cipher.IPTCInfoCipher()
aIC.print_iptcinfo("Clippy.jpg")
def test_write_and_read_from_jpg(self):
aIC = iptc_info_cipher.IPTCInfoCipher()
input_list=[1,2,3,4,5]
aIC.write_list_to_jpg("Clippy.jpg",input_list)
output_list=aIC.read_list_from_jpg("Clippy.jpg")
self.assertTrue(set(input_list).intersection(output_list))
def test_encrypted_write_and_read_from_jpg(self):
aIC = iptc_info_cipher.IPTCInfoCipher()
input_list=[1,2,3,4,5]
aIC.write_encrypted_list_to_jpg("ClippyCrypto.jpg","password",input_list)
output_list=aIC.read_encrypted_list_from_jpg("ClippyCrypto.jpg","password")
self.assertTrue(set(input_list).intersection(output_list))
def test_read_list_from_url(self):
aIC = iptc_info_cipher.IPTCInfoCipher()
url = "https://github.com/JohnFunkCode/iptc_info_ciper/raw/master/Clippy.jpg"
l=aIC.read_list_from_url(url)
#print("data from {}:{}".format(url,l))
self.assertTrue(len(l)>0)
def test_read_encrypted_list_from_url(self):
aIC = iptc_info_cipher.IPTCInfoCipher()
url = "https://github.com/JohnFunkCode/iptc_info_ciper/raw/master/ClippyCrypto.jpg"
l=aIC.read_encrypted_list_from_url(url,"password")
#print("data from encrypted {}:{}".format(url,l))
self.assertTrue(len(l)>0)
if __name__ == '__main__':
unittest.main()