summaryrefslogtreecommitdiffstats
path: root/activities/tests/models
diff options
context:
space:
mode:
authorAndrew Godwin2022-11-21 20:10:01 -0700
committerAndrew Godwin2022-11-21 20:10:01 -0700
commit0d1e09fbcdb1a1db93d9561c9323c7ef105e71ca (patch)
tree3799cb9523757c98b62e6a552cdf13ca3d98bb1b /activities/tests/models
parente38e17678432613111ea220260c5d76677a84d3e (diff)
downloadtakahe-0d1e09fbcdb1a1db93d9561c9323c7ef105e71ca.tar.gz
takahe-0d1e09fbcdb1a1db93d9561c9323c7ef105e71ca.tar.bz2
takahe-0d1e09fbcdb1a1db93d9561c9323c7ef105e71ca.zip
Refactor almost all tests into /tests/
Diffstat (limited to 'activities/tests/models')
-rw-r--r--activities/tests/models/__init__.py0
-rw-r--r--activities/tests/models/test_post.py31
2 files changed, 0 insertions, 31 deletions
diff --git a/activities/tests/models/__init__.py b/activities/tests/models/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/activities/tests/models/__init__.py
+++ /dev/null
diff --git a/activities/tests/models/test_post.py b/activities/tests/models/test_post.py
deleted file mode 100644
index 5c7fca2..0000000
--- a/activities/tests/models/test_post.py
+++ /dev/null
@@ -1,31 +0,0 @@
-import pytest
-from pytest_httpx import HTTPXMock
-
-from activities.models import Post
-
-
-@pytest.mark.django_db
-def test_fetch_post(httpx_mock: HTTPXMock):
- """
- Tests that a post we don't have locally can be fetched by by_object_uri
- """
- httpx_mock.add_response(
- url="https://example.com/test-post",
- json={
- "@context": [
- "https://www.w3.org/ns/activitystreams",
- ],
- "id": "https://example.com/test-post",
- "type": "Note",
- "published": "2022-11-13T23:20:16Z",
- "url": "https://example.com/test-post",
- "attributedTo": "https://example.com/test-actor",
- "content": "BEEEEEES",
- },
- )
- # Fetch with a HTTP access
- post = Post.by_object_uri("https://example.com/test-post", fetch=True)
- assert post.content == "BEEEEEES"
- assert post.author.actor_uri == "https://example.com/test-actor"
- # Fetch again with a DB hit
- assert Post.by_object_uri("https://example.com/test-post").id == post.id