kopia lustrzana https://github.com/ihabunek/toot
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.pull/474/head
rodzic
225dfbfb2e
commit
43f51cbbb9
|
@ -1,4 +1,5 @@
|
||||||
import json
|
import json
|
||||||
|
from tests.integration.conftest import register_account
|
||||||
|
|
||||||
from toot import App, User, api, cli
|
from toot import App, User, api, cli
|
||||||
from toot.entities import Account, Relationship, from_dict
|
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
|
assert f"@{friend.username}" in result.stdout
|
||||||
|
|
||||||
|
|
||||||
def test_following(app: App, user: User, friend: User, friend_id, run):
|
def test_following(app: App, user: User, run):
|
||||||
# Make sure we're not initially following friend
|
friend = register_account(app)
|
||||||
api.unfollow(app, user, friend_id)
|
|
||||||
|
|
||||||
result = run(cli.accounts.following, user.username)
|
result = run(cli.accounts.following, user.username)
|
||||||
assert result.exit_code == 0
|
assert result.exit_code == 0
|
||||||
|
@ -84,9 +84,8 @@ def test_following_not_found(run):
|
||||||
assert result.stderr.strip() == "Error: Account not found"
|
assert result.stderr.strip() == "Error: Account not found"
|
||||||
|
|
||||||
|
|
||||||
def test_following_json(app: App, user: User, friend: User, user_id, friend_id, run_json):
|
def test_following_json(app: App, user: User, user_id, run_json):
|
||||||
# Make sure we're not initially following friend
|
friend = register_account(app)
|
||||||
api.unfollow(app, user, friend_id)
|
|
||||||
|
|
||||||
result = run_json(cli.accounts.following, user.username, "--json")
|
result = run_json(cli.accounts.following, user.username, "--json")
|
||||||
assert result == []
|
assert result == []
|
||||||
|
@ -200,9 +199,8 @@ def test_mute_json(app: App, user: User, friend: User, run_json, friend_id):
|
||||||
assert result == []
|
assert result == []
|
||||||
|
|
||||||
|
|
||||||
def test_block(app, user, friend, friend_id, run):
|
def test_block(app, user, run):
|
||||||
# Make sure we're not initially blocking friend
|
friend = register_account(app)
|
||||||
api.unblock(app, user, friend_id)
|
|
||||||
|
|
||||||
result = run(cli.accounts.blocked)
|
result = run(cli.accounts.blocked)
|
||||||
assert result.exit_code == 0
|
assert result.exit_code == 0
|
||||||
|
|
Ładowanie…
Reference in New Issue