This repository has been archived on 2023-09-24. You can view files and clone it, but cannot push or open issues or pull requests.
takahe/tests/activities/views/test_posts.py

21 lines
607 B
Python
Raw Normal View History

import pytest
from django.test.client import Client
2022-11-27 19:09:46 +01:00
from activities.models import Post
from users.models import Identity
2022-11-27 19:09:46 +01:00
@pytest.mark.django_db
def test_post_delete_security(client_with_identity: Client, other_identity: Identity):
"""
Tests that you can't delete other users' posts with URL fiddling
"""
2022-11-27 19:09:46 +01:00
other_post = Post.objects.create(
content="<p>OTHER POST!</p>",
author=other_identity,
local=True,
visibility=Post.Visibilities.public,
)
response = client_with_identity.get(other_post.urls.action_delete)
assert response.status_code == 403