Beispiel #1
0
def assert_likes(session, likes, post):
    total = jsearch('edge_media_preview_like.count', post)
    likes = assert_iter(session, likes, total)
    for l in likes:
        assert l['id']
        assert l['username']
    return likes
Beispiel #2
0
def assert_followers(session, followers, user):
    total = jsearch('edge_followed_by.count', user)
    followers = assert_iter(session, followers, total)
    for f in followers:
        assert f['id']
        assert f['username']
    return followers
Beispiel #3
0
def assert_following(session, following, user):
    total = jsearch('edge_follow.count', user)
    following = assert_iter(session, following, total)
    for f in following:
        assert f['id']
        assert f['username']
    return following
Beispiel #4
0
def assert_comments(session, comments, post):
    total = jsearch('edge_media_to_comment.count', post)
    comments = assert_iter(session, comments, total)
    for c in comments:
        assert c['id']
        assert c['text']
        assert c['created_at']
        assert c['owner']['id']
        assert c['owner']['username']
    return comments
Beispiel #5
0
def assert_posts(session, posts, user=None):
    if user:
        total = jsearch('edge_owner_to_timeline_media.count', user)
    else:
        total = None
    posts = assert_iter(session, posts, total)
    for p in posts:
        assert p['id']
        assert p['shortcode']
        assert p['display_url']
        assert p['owner']['id']
    return posts