async def test_user_can_not_change_article_state_twice(
    app: FastAPI,
    authorized_client: Client,
    test_article: Article,
    test_user: UserInDB,
    pool: Pool,
    api_method: str,
    route_name: str,
    favorite_state: bool,
) -> None:
    if favorite_state:
        async with pool.acquire() as connection:
            articles_repo = ArticlesRepository(connection)
            await articles_repo.add_article_into_favorites(
                article=test_article, user=test_user)

    response = await authorized_client.request(
        api_method, app.url_path_for(route_name, slug=test_article.slug))

    assert response.status_code == status.HTTP_400_BAD_REQUEST
async def test_user_will_receive_only_following_articles(
    app: FastAPI,
    authorized_client: Client,
    test_article: Article,
    test_user: UserInDB,
    pool: Pool,
) -> None:
    following_author_username = "******"
    async with pool.acquire() as connection:
        users_repo = UsersRepository(connection)
        profiles_repo = ProfilesRepository(connection)
        articles_repo = ArticlesRepository(connection)

        for i in range(5):
            user = await users_repo.create_user(username=f"user-{i}",
                                                email=f"user-{i}@email.com",
                                                password="******")
            if i == 2:
                await profiles_repo.add_user_into_followers(
                    target_user=user, requested_user=test_user)

            for j in range(5):
                await articles_repo.create_article(
                    slug=f"slug-{i}-{j}",
                    title="tmp",
                    description="tmp",
                    body="tmp",
                    author=user,
                    tags=[f"tag-{i}-{j}"],
                )

    response = await authorized_client.get(
        app.url_path_for("articles:get-user-feed-articles"))

    articles_from_response = ListOfArticlesInResponse(**response.json())
    assert len(articles_from_response.articles) == 5

    all_from_following = (article.author.username == following_author_username
                          for article in articles_from_response.articles)
    assert all(all_from_following)