Add integration tests for status and thread
This commit is contained in:
parent
3a375b77ee
commit
8aad38671e
1 changed files with 34 additions and 0 deletions
|
@ -1,3 +1,5 @@
|
|||
import re
|
||||
from uuid import uuid4
|
||||
import pytest
|
||||
|
||||
from toot import api
|
||||
|
@ -80,3 +82,35 @@ def test_tags(run, base_url):
|
|||
|
||||
out = run("tags_followed")
|
||||
assert out == f"* #bar\t{base_url}/tags/bar"
|
||||
|
||||
|
||||
def test_status(app, user, run):
|
||||
uuid = str(uuid4())
|
||||
response = api.post_status(app, user, uuid)
|
||||
|
||||
out = run("status", response["id"])
|
||||
assert uuid in out
|
||||
assert user.username in out
|
||||
assert response["id"] in out
|
||||
|
||||
|
||||
def test_thread(app, user, run):
|
||||
uuid = str(uuid4())
|
||||
s1 = api.post_status(app, user, uuid + "1")
|
||||
s2 = api.post_status(app, user, uuid + "2", in_reply_to_id=s1["id"])
|
||||
s3 = api.post_status(app, user, uuid + "3", in_reply_to_id=s2["id"])
|
||||
|
||||
for status in [s1, s2, s3]:
|
||||
out = run("thread", status["id"])
|
||||
bits = re.split(r"─+", out)
|
||||
bits = [b for b in bits if b]
|
||||
|
||||
assert len(bits) == 3
|
||||
|
||||
assert s1["id"] in bits[0]
|
||||
assert s2["id"] in bits[1]
|
||||
assert s3["id"] in bits[2]
|
||||
|
||||
assert f"{uuid}1" in bits[0]
|
||||
assert f"{uuid}2" in bits[1]
|
||||
assert f"{uuid}3" in bits[2]
|
||||
|
|
Loading…
Reference in a new issue