From 4fc0bf7ed3c77d3eadff1df11ed945225911abd2 Mon Sep 17 00:00:00 2001 From: Stuart Maxwell Date: Thu, 30 May 2024 09:14:33 +1200 Subject: [PATCH] Rename test files --- ...tegory_cache.py => test_cache_category.py} | 0 ...cache.py => test_cache_published_posts.py} | 0 tests/test_post_authors.py | 33 ------------------- ...s.py => test_templatetags_djpress_tags.py} | 0 4 files changed, 33 deletions(-) rename tests/{test_category_cache.py => test_cache_category.py} (100%) rename tests/{test_published_posts_cache.py => test_cache_published_posts.py} (100%) delete mode 100644 tests/test_post_authors.py rename tests/{test_djpress_tags.py => test_templatetags_djpress_tags.py} (100%) diff --git a/tests/test_category_cache.py b/tests/test_cache_category.py similarity index 100% rename from tests/test_category_cache.py rename to tests/test_cache_category.py diff --git a/tests/test_published_posts_cache.py b/tests/test_cache_published_posts.py similarity index 100% rename from tests/test_published_posts_cache.py rename to tests/test_cache_published_posts.py diff --git a/tests/test_post_authors.py b/tests/test_post_authors.py deleted file mode 100644 index c14c06b..0000000 --- a/tests/test_post_authors.py +++ /dev/null @@ -1,33 +0,0 @@ -import pytest -from django.contrib.auth.models import User -from djpress.models import Post - - -@pytest.mark.django_db -def test_get_published_posts_by_author(): - # Create a test user - user = User.objects.create_user(username="testuser", password="testpass") - - # Create some published posts by the test user - post1 = Post.post_objects.create( - title="Post 1", content="Content of post 1.", author=user, status="published" - ) - post2 = Post.post_objects.create( - title="Post 2", content="Content of post 2.", author=user, status="published" - ) - - # Create a draft post by the test user - draft_post = Post.post_objects.create( - title="Draft Post", - content="Content of draft post.", - author=user, - status="draft", - ) - - # Call the method being tested - published_posts = Post.post_objects.get_published_posts_by_author(user) - - # Assert that only the published posts by the test user are returned - assert post1 in published_posts - assert post2 in published_posts - assert draft_post not in published_posts diff --git a/tests/test_djpress_tags.py b/tests/test_templatetags_djpress_tags.py similarity index 100% rename from tests/test_djpress_tags.py rename to tests/test_templatetags_djpress_tags.py