1
0
mirror of https://github.com/ihabunek/toot synced 2024-12-23 07:27:12 +01:00

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.
This commit is contained in:
Ivan Habunek 2024-03-09 09:24:00 +01:00
parent 225dfbfb2e
commit 43f51cbbb9
No known key found for this signature in database
GPG Key ID: F5F0623FF5EBCB3D

View File

@ -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