nitter/tests/test_card.py

90 lines
3.9 KiB
Python
Raw Normal View History

2019-08-12 22:29:48 +00:00
from base import BaseTestCase, Card, Conversation
from parameterized import parameterized
card = [
['nim_lang/status/1136652293510717440',
'Version 0.20.0 released',
'We are very proud to announce Nim version 0.20. This is a massive release, both literally and figuratively. It contains more than 1,000 commits and it marks our release candidate for version 1.0!',
2022-05-13 17:20:34 +00:00
'nim-lang.org', True],
2019-08-12 22:29:48 +00:00
['voidtarget/status/1094632512926605312',
'Basic OBS Studio plugin, written in nim, supporting C++ (C fine too)',
'Basic OBS Studio plugin, written in nim, supporting C++ (C fine too) - obsplugin.nim',
2019-08-15 21:17:13 +00:00
'gist.github.com', True],
2019-08-12 22:29:48 +00:00
['nim_lang/status/1082989146040340480',
'Nim in 2018: A short recap',
'There were several big news in the Nim world in 2018 two new major releases, partnership with Status, and much more. But let us go chronologically.',
'nim-lang.org', True]
2019-08-12 22:29:48 +00:00
]
no_thumb = [
2023-08-25 14:28:30 +00:00
['FluentAI/status/1116417904831029248',
2023-11-01 04:52:44 +00:00
'LinkedIn',
'This link will take you to a page thats not on LinkedIn',
'lnkd.in'],
2023-08-25 14:28:30 +00:00
['Thom_Wolf/status/1122466524860702729',
'facebookresearch/fairseq',
'Facebook AI Research Sequence-to-Sequence Toolkit written in Python. - GitHub - facebookresearch/fairseq: Facebook AI Research Sequence-to-Sequence Toolkit written in Python.',
'github.com'],
2019-08-12 22:29:48 +00:00
['brent_p/status/1088857328680488961',
'Hts Nim Sugar',
'hts-nim is a library that allows one to use htslib via the nim programming language. Nim is a garbage-collected language that compiles to C and often has similar performance. I have become very...',
2019-10-17 22:10:40 +00:00
'brentp.github.io'],
2019-12-06 12:01:05 +00:00
['voidtarget/status/1133028231672582145',
'sinkingsugar/nimqt-example',
'A sample of a Qt app written using mostly nim. Contribute to sinkingsugar/nimqt-example development by creating an account on GitHub.',
'github.com']
2019-08-12 22:29:48 +00:00
]
playable = [
['nim_lang/status/1118234460904919042',
'Nim development blog 2019-03',
2021-07-18 01:56:51 +00:00
'Arne (aka Krux02)* debugging: * improved nim-gdb, $ works, framefilter * alias for --debugger:native: -g* bugs: * forwarding of .pure. * sizeof union* fe...',
2019-08-15 21:17:13 +00:00
'youtube.com'],
2019-08-12 22:29:48 +00:00
['nim_lang/status/1121090879823986688',
'Nim - First natively compiled language w/ hot code-reloading at...',
2021-07-18 01:56:51 +00:00
'#nim #c++ #ACCUConfNim is a statically typed systems and applications programming language which offers perhaps some of the most powerful metaprogramming cap...',
2019-10-02 08:13:17 +00:00
'youtube.com']
2019-08-12 22:29:48 +00:00
]
class CardTest(BaseTestCase):
@parameterized.expand(card)
2019-08-15 21:17:13 +00:00
def test_card(self, tweet, title, description, destination, large):
2019-08-12 22:29:48 +00:00
self.open_nitter(tweet)
2020-11-08 03:27:34 +00:00
c = Card(Conversation.main + " ")
self.assert_text(title, c.title)
self.assert_text(destination, c.destination)
2023-04-21 21:33:52 +00:00
self.assertIn('/pic/', self.get_image_url(c.image + ' img'))
2019-08-12 22:29:48 +00:00
if len(description) > 0:
2020-11-08 03:27:34 +00:00
self.assert_text(description, c.description)
2019-08-12 22:29:48 +00:00
if large:
self.assert_element_visible('.card.large')
else:
self.assert_element_not_visible('.card.large')
@parameterized.expand(no_thumb)
def test_card_no_thumb(self, tweet, title, description, destination):
self.open_nitter(tweet)
2020-11-08 03:27:34 +00:00
c = Card(Conversation.main + " ")
self.assert_text(title, c.title)
self.assert_text(destination, c.destination)
2019-08-12 22:29:48 +00:00
if len(description) > 0:
2020-11-08 03:27:34 +00:00
self.assert_text(description, c.description)
2019-08-12 22:29:48 +00:00
@parameterized.expand(playable)
2019-08-15 21:17:13 +00:00
def test_card_playable(self, tweet, title, description, destination):
2019-08-12 22:29:48 +00:00
self.open_nitter(tweet)
2020-11-08 03:27:34 +00:00
c = Card(Conversation.main + " ")
self.assert_text(title, c.title)
self.assert_text(destination, c.destination)
2023-04-21 21:33:52 +00:00
self.assertIn('/pic/', self.get_image_url(c.image + ' img'))
2019-08-12 22:29:48 +00:00
self.assert_element_visible('.card-overlay')
if len(description) > 0:
2020-11-08 03:27:34 +00:00
self.assert_text(description, c.description)