-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
55 lines (49 loc) · 1.12 KB
/
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import unittest
from lib import read_files
import posting
expected_post_data = [
{
'type': posting.GALLERY_POST,
'title': 'Test',
'gallery': [
{"image_path":"input/test.gif"},
{"image_path":"input/seen.png"},
{"image_path":"input/test.jpg"},
]
},
{
'type': posting.VIDEO_POST,
'title': 'Test',
'video_path': 'input/test.mp4',
# 'thumbnail': 'thumbnails/frfrfr.png'
},
]
test_post_data = [
{
'type': posting.TITLE_TEXT_POST,
'title': 'Test title',
'text': 'testing',
},
{
'type': posting.TITLE_URL_POST,
'title': 'Test title',
'url': 'https://testing.site/',
},
{
'type': posting.IMAGE_POST,
'title': 'Test image',
'image_path': 'input/seen.png',
},
{
'type': posting.IMAGE_POST,
'title': 'Test image',
'image_path': 'input/test.gif',
},
] + expected_post_data
class TestPosting(unittest.TestCase):
def test_posting_data_formatter(self):
post_data = posting.process_files(read_files('input'), 'Test', False)
print(post_data)
self.assertEqual(expected_post_data, post_data)
if __name__ == '__main__':
unittest.main()