def _create_post_objects(self, post_soup, post_size): # create post objects for each post on the page self.posts = [] for post in post_soup: shortcode = post["href"].replace("/p/", "")[:-1] self.posts.append(Post.from_shortcode(shortcode)) if len(self.posts) >= post_size: break
def test_from_shortcode(google_post): result_post: Post = Post.from_shortcode( shortcode=google_post.data_points[0].shortcode) result_post.static_load() assert result_post.url == google_post.url assert result_post.data_points[0].caption == google_post.data_points[ 0].caption
def test_from_shortcode(self, page_instance): expected_post = "CGX0G64hu4Q" result_profile: Post = Post.from_shortcode(shortcode=expected_post) assert result_profile.url == page_instance.url
def test_from_shortcode(google_post): result_post: Post = Post.from_shortcode(shortcode=google_post.shortcode) assert result_post.url == google_post.url