forked from matthewladams/TikBot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtests.py
More file actions
40 lines (30 loc) · 1.3 KB
/
tests.py
File metadata and controls
40 lines (30 loc) · 1.3 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
import unittest
from validator import extractUrl, isSupportedUrl
from downloader import download
from dbInteraction import savePost, doesPostExist
class TestUrlParser(unittest.TestCase):
def test_supportedUrl(self):
url = "https://vm.tiktok.com/ZSJrgyXdt/"
supportedResponse = isSupportedUrl(url)
self.assertEqual(supportedResponse["supported"], 'true')
def test_unsupportedUrl(self):
url = "https://www.twitch.tv/robcdee/clip/AgileLivelyCucumberPartyTime"
supportedResponse = isSupportedUrl(url)
self.assertEqual(supportedResponse["supported"], 'false')
class TestDownloader(unittest.TestCase):
def test_imgur_gallery(self):
url = "https://imgur.com/gallery/1jK60ka/"
downloadResponse = download(url)
self.assertEqual(downloadResponse["messages"], '')
def test_tiktok(self):
url = "https://vm.tiktok.com/ZSJbnjPMY/"
downloadResponse = download(url)
self.assertEqual(downloadResponse["messages"], '')
# TODO - how to safely test on github?
# class TestInsertDb(unittest.TestCase):
# def test_insert_post(self):
# savePost("Unit Test", "123420", "Fake Platform")
# def test_post_exist(self):
# doesPostExist("123420", "Fake Platform")
if __name__ == '__main__':
unittest.main()