Split tests TestInstaloader{Anonymously,LoggedIn}
This commit is contained in:
parent
5d513da73c
commit
dcd16f29c2
@ -16,7 +16,7 @@ PAGING_MAX_COUNT = 15
|
|||||||
PRIVATE_PROFILE = "aandergr"
|
PRIVATE_PROFILE = "aandergr"
|
||||||
|
|
||||||
|
|
||||||
class TestInstaloader(unittest.TestCase):
|
class TestInstaloaderAnonymously(unittest.TestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.dir = tempfile.mkdtemp()
|
self.dir = tempfile.mkdtemp()
|
||||||
@ -38,84 +38,79 @@ class TestInstaloader(unittest.TestCase):
|
|||||||
self.L.download_profile(PUBLIC_PROFILE, profile_pic=False, fast_update=True)
|
self.L.download_profile(PUBLIC_PROFILE, profile_pic=False, fast_update=True)
|
||||||
self.L.download_profile(PUBLIC_PROFILE, profile_pic=False, fast_update=True)
|
self.L.download_profile(PUBLIC_PROFILE, profile_pic=False, fast_update=True)
|
||||||
|
|
||||||
@unittest.SkipTest
|
|
||||||
def test_stories_download(self):
|
|
||||||
self.L.load_session_from_file(OWN_USERNAME)
|
|
||||||
self.L.download_stories()
|
|
||||||
|
|
||||||
@unittest.SkipTest
|
|
||||||
def test_private_profile_download(self):
|
|
||||||
self.L.load_session_from_file(OWN_USERNAME)
|
|
||||||
self.L.download_profile(PRIVATE_PROFILE, download_stories=True)
|
|
||||||
|
|
||||||
def test_profile_pic_download(self):
|
def test_profile_pic_download(self):
|
||||||
self.L.download_profile(PUBLIC_PROFILE, profile_pic_only=True)
|
self.L.download_profile(PUBLIC_PROFILE, profile_pic_only=True)
|
||||||
|
|
||||||
def test_hashtag_download(self):
|
def test_hashtag_download(self):
|
||||||
self.L.download_hashtag(HASHTAG, NORMAL_MAX_COUNT)
|
self.L.download_hashtag(HASHTAG, NORMAL_MAX_COUNT)
|
||||||
|
|
||||||
def test_feed_download(self):
|
|
||||||
self.L.load_session_from_file(OWN_USERNAME)
|
|
||||||
self.L.download_feed_posts(NORMAL_MAX_COUNT)
|
|
||||||
|
|
||||||
def test_feed_paging(self):
|
|
||||||
self.L.load_session_from_file(OWN_USERNAME)
|
|
||||||
for count, post in enumerate(self.L.get_feed_posts()):
|
|
||||||
print(post)
|
|
||||||
if count == PAGING_MAX_COUNT:
|
|
||||||
break
|
|
||||||
|
|
||||||
def test_saved_download(self):
|
|
||||||
self.L.load_session_from_file(OWN_USERNAME)
|
|
||||||
self.L.download_saved_posts(NORMAL_MAX_COUNT)
|
|
||||||
|
|
||||||
def test_saved_paging(self):
|
|
||||||
self.L.load_session_from_file(OWN_USERNAME)
|
|
||||||
for count, post in enumerate(instaloader.Profile.from_username(self.L.context, OWN_USERNAME).get_saved_posts()):
|
|
||||||
print(post)
|
|
||||||
if count == PAGING_MAX_COUNT:
|
|
||||||
break
|
|
||||||
|
|
||||||
def test_test_login(self):
|
|
||||||
self.L.load_session_from_file(OWN_USERNAME)
|
|
||||||
self.assertEqual(OWN_USERNAME, self.L.test_login())
|
|
||||||
|
|
||||||
def test_get_followees(self):
|
|
||||||
self.L.load_session_from_file(OWN_USERNAME)
|
|
||||||
profile = instaloader.Profile.from_username(self.L.context, OWN_USERNAME)
|
|
||||||
for f in profile.get_followees():
|
|
||||||
print(f['username'])
|
|
||||||
|
|
||||||
def test_get_followers(self):
|
|
||||||
self.L.load_session_from_file(OWN_USERNAME)
|
|
||||||
profile = instaloader.Profile.from_username(self.L.context, OWN_USERNAME)
|
|
||||||
for f in profile.get_followers():
|
|
||||||
print(f['username'])
|
|
||||||
|
|
||||||
def test_get_username_by_id(self):
|
|
||||||
self.L.load_session_from_file(OWN_USERNAME)
|
|
||||||
self.assertEqual(PUBLIC_PROFILE.lower(),
|
|
||||||
instaloader.Profile.from_id(self.L.context, PUBLIC_PROFILE_ID).username)
|
|
||||||
|
|
||||||
def test_get_id_by_username(self):
|
def test_get_id_by_username(self):
|
||||||
self.assertEqual(PUBLIC_PROFILE_ID,
|
self.assertEqual(PUBLIC_PROFILE_ID,
|
||||||
instaloader.Profile.from_username(self.L.context, PUBLIC_PROFILE).userid)
|
instaloader.Profile.from_username(self.L.context, PUBLIC_PROFILE).userid)
|
||||||
|
|
||||||
def test_get_likes(self):
|
|
||||||
self.L.load_session_from_file(OWN_USERNAME)
|
|
||||||
for post in instaloader.Profile.from_username(self.L.context, OWN_USERNAME).get_posts():
|
|
||||||
for like in post.get_likes():
|
|
||||||
print(like['username'])
|
|
||||||
break
|
|
||||||
|
|
||||||
def test_post_from_mediaid(self):
|
def test_post_from_mediaid(self):
|
||||||
for post in instaloader.Profile.from_username(self.L.context, PUBLIC_PROFILE).get_posts():
|
for post in instaloader.Profile.from_username(self.L.context, PUBLIC_PROFILE).get_posts():
|
||||||
post2 = instaloader.Post.from_mediaid(self.L.context, post.mediaid)
|
post2 = instaloader.Post.from_mediaid(self.L.context, post.mediaid)
|
||||||
self.assertEqual(post, post2)
|
self.assertEqual(post, post2)
|
||||||
break
|
break
|
||||||
|
|
||||||
def test_explore_paging(self):
|
|
||||||
|
class TestInstaloaderLoggedIn(TestInstaloaderAnonymously):
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
super().setUp()
|
||||||
self.L.load_session_from_file(OWN_USERNAME)
|
self.L.load_session_from_file(OWN_USERNAME)
|
||||||
|
|
||||||
|
@unittest.SkipTest
|
||||||
|
def test_stories_download(self):
|
||||||
|
self.L.download_stories()
|
||||||
|
|
||||||
|
@unittest.SkipTest
|
||||||
|
def test_private_profile_download(self):
|
||||||
|
self.L.download_profile(PRIVATE_PROFILE, download_stories=True)
|
||||||
|
|
||||||
|
def test_feed_download(self):
|
||||||
|
self.L.download_feed_posts(NORMAL_MAX_COUNT)
|
||||||
|
|
||||||
|
def test_feed_paging(self):
|
||||||
|
for count, post in enumerate(self.L.get_feed_posts()):
|
||||||
|
print(post)
|
||||||
|
if count == PAGING_MAX_COUNT:
|
||||||
|
break
|
||||||
|
|
||||||
|
def test_saved_download(self):
|
||||||
|
self.L.download_saved_posts(NORMAL_MAX_COUNT)
|
||||||
|
|
||||||
|
def test_saved_paging(self):
|
||||||
|
for count, post in enumerate(instaloader.Profile.from_username(self.L.context, OWN_USERNAME).get_saved_posts()):
|
||||||
|
print(post)
|
||||||
|
if count == PAGING_MAX_COUNT:
|
||||||
|
break
|
||||||
|
|
||||||
|
def test_test_login(self):
|
||||||
|
self.assertEqual(OWN_USERNAME, self.L.test_login())
|
||||||
|
|
||||||
|
def test_get_followees(self):
|
||||||
|
profile = instaloader.Profile.from_username(self.L.context, OWN_USERNAME)
|
||||||
|
for f in profile.get_followees():
|
||||||
|
print(f['username'])
|
||||||
|
|
||||||
|
def test_get_followers(self):
|
||||||
|
profile = instaloader.Profile.from_username(self.L.context, OWN_USERNAME)
|
||||||
|
for f in profile.get_followers():
|
||||||
|
print(f['username'])
|
||||||
|
|
||||||
|
def test_get_username_by_id(self):
|
||||||
|
self.assertEqual(PUBLIC_PROFILE.lower(),
|
||||||
|
instaloader.Profile.from_id(self.L.context, PUBLIC_PROFILE_ID).username)
|
||||||
|
|
||||||
|
def test_get_likes(self):
|
||||||
|
for post in instaloader.Profile.from_username(self.L.context, OWN_USERNAME).get_posts():
|
||||||
|
for like in post.get_likes():
|
||||||
|
print(like['username'])
|
||||||
|
break
|
||||||
|
|
||||||
|
def test_explore_paging(self):
|
||||||
for count, post in enumerate(self.L.get_explore_posts()):
|
for count, post in enumerate(self.L.get_explore_posts()):
|
||||||
print(post)
|
print(post)
|
||||||
if count == PAGING_MAX_COUNT:
|
if count == PAGING_MAX_COUNT:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user