1
0
mirror of https://github.com/zedeus/nitter synced 2024-11-22 09:57:16 +01:00

Expand profile tests to cover new metadata

This commit is contained in:
Zed 2019-08-12 17:01:45 +02:00
parent 17c187ea15
commit 07cca94916
2 changed files with 21 additions and 7 deletions

View File

@ -19,6 +19,10 @@ class Profile(object):
verified = '.verified-icon'
banner = '.profile-banner'
bio = '.profile-bio'
location = '.profile-location'
website = '.profile-website'
joinDate = '.profile-joindate'
mediaCount = '.photo-rail-header'
class Timeline(object):

View File

@ -3,8 +3,9 @@ from parameterized import parameterized
profiles = [
['mobile_test', 'Test account',
'Test Account. test test Testing username with @mobile_test_2 and a #hashtag'],
['mobile_test_2', 'mobile test 2', '']
'Test Account. test test Testing username with @mobile_test_2 and a #hashtag',
'📍 San Francisco, CA', '🔗 example.com/foobar', '📅 Joined October 2009', '100'],
['mobile_test_2', 'mobile test 2', '', '', '', '📅 Joined January 2011', '13']
]
verified = [['jack'], ['elonmusk']]
@ -28,15 +29,24 @@ banner_image = [
class ProfileTest(BaseTestCase):
@parameterized.expand(profiles)
def test_data(self, username, fullname, bio):
def test_data(self, username, fullname, bio, location, website, joinDate, mediaCount):
self.open_nitter(username)
self.assert_exact_text(fullname, Profile.fullname)
self.assert_exact_text(f'@{username}', Profile.username)
if len(bio) > 0:
self.assert_exact_text(bio, Profile.bio)
else:
self.assert_element_absent(Profile.bio)
tests = [
(bio, Profile.bio),
(location, Profile.location),
(website, Profile.website),
(joinDate, Profile.joinDate),
(f"🖼 {mediaCount} Photos and videos", Profile.mediaCount)
]
for text, selector in tests:
if len(text) > 0:
self.assert_exact_text(text, selector)
else:
self.assert_element_absent(selector)
@parameterized.expand(verified)
def test_verified(self, username):