From 43f51cbbb9dc2d80f1b012f7103e3258a391c8c2 Mon Sep 17 00:00:00 2001 From: Ivan Habunek Date: Sat, 9 Mar 2024 09:24:00 +0100 Subject: [PATCH] Make tests a bit more robust By creating a new user we don't need to check if we're following or blocking them before running the test. --- tests/integration/test_accounts.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/tests/integration/test_accounts.py b/tests/integration/test_accounts.py index 3df9c92..8fe1044 100644 --- a/tests/integration/test_accounts.py +++ b/tests/integration/test_accounts.py @@ -1,4 +1,5 @@ import json +from tests.integration.conftest import register_account from toot import App, User, api, cli from toot.entities import Account, Relationship, from_dict @@ -35,9 +36,8 @@ def test_whois(app: App, friend: User, run): assert f"@{friend.username}" in result.stdout -def test_following(app: App, user: User, friend: User, friend_id, run): - # Make sure we're not initially following friend - api.unfollow(app, user, friend_id) +def test_following(app: App, user: User, run): + friend = register_account(app) result = run(cli.accounts.following, user.username) assert result.exit_code == 0 @@ -84,9 +84,8 @@ def test_following_not_found(run): assert result.stderr.strip() == "Error: Account not found" -def test_following_json(app: App, user: User, friend: User, user_id, friend_id, run_json): - # Make sure we're not initially following friend - api.unfollow(app, user, friend_id) +def test_following_json(app: App, user: User, user_id, run_json): + friend = register_account(app) result = run_json(cli.accounts.following, user.username, "--json") assert result == [] @@ -200,9 +199,8 @@ def test_mute_json(app: App, user: User, friend: User, run_json, friend_id): assert result == [] -def test_block(app, user, friend, friend_id, run): - # Make sure we're not initially blocking friend - api.unblock(app, user, friend_id) +def test_block(app, user, run): + friend = register_account(app) result = run(cli.accounts.blocked) assert result.exit_code == 0