2019-08-12 15:02:07 +00:00
|
|
|
from base import BaseTestCase, Quote, Conversation
|
|
|
|
from parameterized import parameterized
|
|
|
|
|
|
|
|
text = [
|
|
|
|
['elonmusk/status/1138136540096319488',
|
2022-11-27 15:00:16 +00:00
|
|
|
'TREV PAGE', '@Model3Owners',
|
2019-08-12 15:02:07 +00:00
|
|
|
"""As of March 58.4% of new car sales in Norway are electric.
|
|
|
|
|
|
|
|
What are we doing wrong? reuters.com/article/us-norwa…"""],
|
|
|
|
|
2022-06-04 00:24:43 +00:00
|
|
|
['nim_lang/status/1491461266849808397#m',
|
2023-11-15 10:40:21 +00:00
|
|
|
'Nim', '@nim_lang',
|
2022-06-04 00:24:43 +00:00
|
|
|
"""What's better than Nim 1.6.0?
|
|
|
|
|
|
|
|
Nim 1.6.2 :)
|
|
|
|
|
|
|
|
nim-lang.org/blog/2021/12/17…"""]
|
2019-08-12 15:02:07 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
image = [
|
|
|
|
['elonmusk/status/1138827760107790336', 'D83h6Y8UIAE2Wlz'],
|
|
|
|
['SpaceX/status/1067155053461426176', 'Ds9EYfxXoAAPNmx']
|
|
|
|
]
|
|
|
|
|
|
|
|
gif = [
|
|
|
|
['SpaceX/status/747497521593737216', 'Cl-R5yFWkAA_-3X'],
|
|
|
|
['nim_lang/status/1068099315074248704', 'DtJSqP9WoAAKdRC']
|
|
|
|
]
|
|
|
|
|
|
|
|
video = [
|
2020-06-01 00:25:56 +00:00
|
|
|
['bkuensting/status/1067316003200217088', 'IyCaQlzF0q8u9vBd']
|
2019-08-12 15:02:07 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
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)
|
2020-06-01 00:25:56 +00:00
|
|
|
def test_gif(self, tweet, url):
|
2019-08-12 15:02:07 +00:00
|
|
|
self.open_nitter(tweet)
|
|
|
|
quote = Quote(Conversation.main + " ")
|
2020-06-01 00:25:56 +00:00
|
|
|
self.assert_element_visible(quote.media)
|
|
|
|
self.assertIn(url, self.get_attribute(quote.media + ' source', 'src'))
|
2019-08-12 15:02:07 +00:00
|
|
|
|
|
|
|
@parameterized.expand(video)
|
2020-06-01 00:25:56 +00:00
|
|
|
def test_video(self, tweet, url):
|
2019-08-12 15:02:07 +00:00
|
|
|
self.open_nitter(tweet)
|
|
|
|
quote = Quote(Conversation.main + " ")
|
2020-06-01 00:25:56 +00:00
|
|
|
self.assert_element_visible(quote.media)
|
|
|
|
self.assertIn(url, self.get_image_url(quote.media + ' img'))
|