diff options
author | Andrew Godwin | 2022-12-12 00:54:51 -0700 |
---|---|---|
committer | Andrew Godwin | 2022-12-12 11:56:49 -0700 |
commit | 35a45f1c55fba69d690929c9420df565e7c5efcc (patch) | |
tree | 0969cf0b9b6c2dec04ec16d0d7444ebff744e377 /tests | |
parent | 7f02d51ba04a533391a2c09b5f780fc8b0193ef7 (diff) | |
download | takahe-35a45f1c55fba69d690929c9420df565e7c5efcc.tar.gz takahe-35a45f1c55fba69d690929c9420df565e7c5efcc.tar.bz2 takahe-35a45f1c55fba69d690929c9420df565e7c5efcc.zip |
A few more fixes and a bad test
Diffstat (limited to 'tests')
-rw-r--r-- | tests/activities/models/test_post_targets.py | 8 | ||||
-rw-r--r-- | tests/api/test_statuses.py | 17 |
2 files changed, 21 insertions, 4 deletions
diff --git a/tests/activities/models/test_post_targets.py b/tests/activities/models/test_post_targets.py index 1e4bbc4..0fbfdd6 100644 --- a/tests/activities/models/test_post_targets.py +++ b/tests/activities/models/test_post_targets.py @@ -46,8 +46,8 @@ def test_post_targets_simple(identity, other_identity, remote_identity): post.local = False post.save() targets = async_to_sync(post.aget_targets)() - # Only targets locals - assert targets == {identity, other_identity} + # Only targets locals who are mentioned + assert targets == {other_identity} @pytest.mark.django_db @@ -87,11 +87,11 @@ def test_post_followers(identity, other_identity, remote_identity): targets = async_to_sync(post.aget_targets)() assert targets == {identity, other_identity, remote_identity} - # Remote post only targets local followers + # Remote post only targets local followers, not the author post.local = False post.save() targets = async_to_sync(post.aget_targets)() - assert targets == {identity, other_identity} + assert targets == {other_identity} # Local Only post only targets local followers post.local = True diff --git a/tests/api/test_statuses.py b/tests/api/test_statuses.py new file mode 100644 index 0000000..1b00642 --- /dev/null +++ b/tests/api/test_statuses.py @@ -0,0 +1,17 @@ +import pytest + + +@pytest.mark.django_db +def test_post_status(api_token, identity, client): + response = client.post( + "/api/v1/statuses", + HTTP_AUTHORIZATION=f"Bearer {api_token.token}", + HTTP_ACCEPT="application/json", + content_type="application/json", + data={ + "status": "Hello, world!", + "visibility": "unlisted", + }, + ).json() + assert response["content"] == "<p>Hello, world!</p>" + assert response["visibility"] == "unlisted" |