-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.py
32 lines (26 loc) · 991 Bytes
/
test.py
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
import unittest
import os
import vidtogig
class TestVideoToGif(unittest.TestCase):
def test_valid_input(self):
video_file = "example.mp4"
duration = 1
gif_file = vidtogig.video_to_gif(video_file, duration)
self.assertEqual(gif_file, "example.gif")
self.assertTrue(os.path.isfile(gif_file))
print(" Valid input Passed ✅ ")
def test_invalid_file_input(self):
video_file = "example.gif"
duration = -1
gif_file = vidtogig.video_to_gif(video_file, duration)
self.assertEqual(gif_file, "Invalid Duaration")
print(" Invalid duration input test Passed ✅ ")
def test_invalid_file_size_input(self):
video_file = "example.gif"
duration = 1
gif_file = vidtogig.video_to_gif(video_file, duration)
size = os.path.getsize(gif_file)
self.assertLess(size, 3000000)
print(" Valid File size Passed ✅ ")
if __name__ == "__main__":
unittest.main()