forked from zedeus/nitter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_quote.py
63 lines (50 loc) · 1.95 KB
/
test_quote.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
56
57
58
59
60
61
62
63
from base import BaseTestCase, Quote, Conversation
from parameterized import parameterized
text = [
['elonmusk/status/1138136540096319488',
'TREV PAGE', '@Model3Owners',
"""As of March 58.4% of new car sales in Norway are electric.
What are we doing wrong? reuters.com/article/us-norwa…"""],
['nim_lang/status/1491461266849808397#m',
'Nim language', '@nim_lang',
"""What's better than Nim 1.6.0?
Nim 1.6.2 :)
nim-lang.org/blog/2021/12/17…"""]
]
image = [
['elonmusk/status/1138827760107790336', 'D83h6Y8UIAE2Wlz'],
['SpaceX/status/1067155053461426176', 'Ds9EYfxXoAAPNmx']
]
gif = [
['SpaceX/status/747497521593737216', 'Cl-R5yFWkAA_-3X'],
['nim_lang/status/1068099315074248704', 'DtJSqP9WoAAKdRC']
]
video = [
['bkuensting/status/1067316003200217088', 'IyCaQlzF0q8u9vBd']
]
class QuoteTest(BaseTestCase):
@parameterized.expand(text)
def test_text(self, tweet, fullname, username, text):
self.open_nitter(tweet)
quote = Quote(Conversation.main + " ")
self.assert_text(fullname, quote.fullname)
self.assert_text(username, quote.username)
self.assert_text(text, quote.text)
@parameterized.expand(image)
def test_image(self, tweet, url):
self.open_nitter(tweet)
quote = Quote(Conversation.main + " ")
self.assert_element_visible(quote.media)
self.assertIn(url, self.get_image_url(quote.media + ' img'))
@parameterized.expand(gif)
def test_gif(self, tweet, url):
self.open_nitter(tweet)
quote = Quote(Conversation.main + " ")
self.assert_element_visible(quote.media)
self.assertIn(url, self.get_attribute(quote.media + ' source', 'src'))
@parameterized.expand(video)
def test_video(self, tweet, url):
self.open_nitter(tweet)
quote = Quote(Conversation.main + " ")
self.assert_element_visible(quote.media)
self.assertIn(url, self.get_image_url(quote.media + ' img'))