コード例 #1
0
def test_serialize_micro_post(post_factory, user_factory):
    with patch('szurubooru.func.posts.get_post_thumbnail_url'):
        posts.get_post_thumbnail_url.return_value \
            = 'https://example.com/thumb.png'
        auth_user = user_factory()
        post = post_factory()
        db.session.add(post)
        db.session.flush()
        assert posts.serialize_micro_post(post, auth_user) == {
            'id': post.post_id,
            'thumbnailUrl': 'https://example.com/thumb.png',
        }
コード例 #2
0
def test_serialize_micro_post(post_factory, user_factory):
    with patch("szurubooru.func.posts.get_post_thumbnail_url"):
        posts.get_post_thumbnail_url.return_value = (
            "https://example.com/thumb.png")
        auth_user = user_factory()
        post = post_factory()
        db.session.add(post)
        db.session.flush()
        assert posts.serialize_micro_post(post, auth_user) == {
            "id": post.post_id,
            "thumbnailUrl": "https://example.com/thumb.png",
        }
コード例 #3
0
def test_serialize_micro_post(post_factory, user_factory):
    with patch('szurubooru.func.posts.get_post_thumbnail_url'):
        posts.get_post_thumbnail_url.return_value \
            = 'https://example.com/thumb.png'
        auth_user = user_factory()
        post = post_factory()
        db.session.add(post)
        db.session.flush()
        assert posts.serialize_micro_post(post, auth_user) == {
            'id': post.post_id,
            'thumbnailUrl': 'https://example.com/thumb.png',
        }
コード例 #4
0
 def serialize_posts(self) -> Any:
     return [
         post for post in
         [posts.serialize_micro_post(rel, None) for rel in self.pool.posts]
     ]