Posts Tests

class tests.posts.factories.CommentFactory(**kwargs)[source]

Bases: DjangoModelFactory

author = <factory.declarations.SubFactory object>
post = <factory.declarations.SubFactory object>
text = <factory.declarations.LazyAttribute object>
class tests.posts.factories.ImageCommentFactory(**kwargs)[source]

Bases: DjangoModelFactory

comment = <factory.declarations.SubFactory object>
image = <factory.declarations.LazyAttribute object>
class tests.posts.factories.LikeFactory(**kwargs)[source]

Bases: DjangoModelFactory

author = <factory.declarations.SubFactory object>
post = <factory.declarations.SubFactory object>
class tests.posts.factories.PostFactory(**kwargs)[source]

Bases: DjangoModelFactory

author = <factory.declarations.SubFactory object>
content = <factory.declarations.LazyAttribute object>
likes_quantity = <factory.declarations.LazyAttribute object>
status = 'published'
title = <factory.declarations.LazyAttribute object>
views_quantity = <factory.declarations.LazyAttribute object>
visibility = 'public'
class tests.posts.factories.PostMediaFactory(**kwargs)[source]

Bases: DjangoModelFactory

original = <factory.declarations.LazyAttribute object>
post = <factory.declarations.SubFactory object>
class tests.posts.factories.TagFactory(**kwargs)[source]

Bases: DjangoModelFactory

name = <factory.declarations.LazyAttribute object>
class tests.posts.test_api.CommentImageAPIViewTestCase(methodName='runTest')[source]

Bases: APITestCase

setUp() None[source]

Hook method for setting up the test fixture before exercising it.

test_comment_not_exists()[source]
test_forbitten()[source]
test_resolve_url()[source]
test_success()[source]
test_unathorize()[source]
class tests.posts.test_api.DeleteCommentAPIViewTestCase(methodName='runTest')[source]

Bases: APITestCase

Test class for UpdateCommentAPIView

setUp() None[source]

Hook method for setting up the test fixture before exercising it.

test_comment_not_exists()[source]
test_forbitten()[source]
test_resolve_url()[source]
test_success()[source]
test_unathorize()[source]
class tests.posts.test_api.DeleteCommentImageAPIViewTestCase(methodName='runTest')[source]

Bases: APITestCase

setUp() None[source]

Hook method for setting up the test fixture before exercising it.

test_comment_not_exists()[source]
test_forbitten()[source]
test_resolve_url()[source]
test_success()[source]
test_unathorize()[source]
class tests.posts.test_api.FavoriteViewSetTestCase(methodName='runTest')[source]

Bases: APITestCase

categories: List[Category]
post: Post
post_second: Post
second_user: User
setUp() None[source]

Hook method for setting up the test fixture before exercising it.

classmethod setUpClass()[source]

Hook method for setting up class fixture before running tests in the class.

test_add_already_added_post_to_favorites()[source]
test_add_to_favorites()[source]
test_add_to_favorites_not_authenticated()[source]
test_add_to_favorites_with_field_check()[source]
test_list_favorites()[source]
test_remove_from_favorites()[source]
test_remove_from_favorites_not_authenticated()[source]
test_remove_from_favorites_with_field_check()[source]
test_remove_not_added_post_from_favorites()[source]
user: User
class tests.posts.test_api.PostAPIViewSetTestCase(methodName='runTest')[source]

Bases: APITestCase

classmethod setUpClass()[source]

Hook method for setting up class fixture before running tests in the class.

test_delete_post()[source]
test_double_post_view()[source]
test_only_author_can_delete_post()[source]
test_only_author_can_update_post()[source]
test_partial_update_post()[source]
test_partial_update_post_new_category()[source]
test_partial_update_post_without_category()[source]
test_post_multiple_users_view()[source]
test_post_stays_with_deleted_mark_after_deletion()[source]
test_post_view()[source]
test_posts_lists_with_private()[source]
test_posts_lists_without_private()[source]
test_retrieve_post()[source]
class tests.posts.test_api.PostCommentAPIViewTestCase(methodName='runTest')[source]

Bases: APITestCase

Test class for PostCommentAPIView

pytestmark = [Mark(name='usefixtures', args=('jpg_file',), kwargs={})]
setUp() None[source]

Hook method for setting up the test fixture before exercising it.

test_comment_add_only_message()[source]
test_comment_deleted_post()[source]
test_comment_private_post_as_author()[source]
test_comment_private_post_as_non_author()[source]
test_comment_when_commenting_forbidden()[source]
test_comment_without_text_and_image()[source]
test_empty_data()[source]
test_post_max_reache_image_limit()[source]
test_post_not_exists()[source]
test_resolve_url()[source]
test_success()[source]
test_unathorize()[source]
class tests.posts.test_api.PostFilterTestCase(methodName='runTest')[source]

Bases: APITestCase

classmethod setUpTestData()[source]

Load initial data for the TestCase.

test_filter_by_category()[source]
test_filter_by_tag()[source]
class tests.posts.test_api.PostLikeAPIViewTestCase(methodName='runTest')[source]

Bases: APITestCase

classmethod setUpTestData() None[source]

Load initial data for the TestCase.

test_already_liked()[source]
test_post_not_exists()[source]
test_resolve_url()[source]
test_success()[source]
test_unathorize()[source]
class tests.posts.test_api.PostMediaTestCase(methodName='runTest')[source]

Bases: APITestCase

classmethod setUpClass()[source]

Hook method for setting up class fixture before running tests in the class.

class tests.posts.test_api.PostTagsAPIViewSetTestCase(methodName='runTest')[source]

Bases: APITestCase

setUp()[source]

Hook method for setting up the test fixture before exercising it.

class tests.posts.test_api.PostsSearchSortingAPITestCase(methodName='runTest')[source]

Bases: APITestCase

setUp()[source]

Hook method for setting up the test fixture before exercising it.

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

test_get_personal_queryset()[source]
test_search_functionality_full_name()[source]
test_search_functionality_title()[source]
test_search_functionality_title_category()[source]
test_search_functionality_title_tag()[source]
test_sorting()[source]
class tests.posts.test_api.TestCommentsPostAPIView(methodName='runTest')[source]

Bases: APITestCase

Test comments Post API View

setUp() None[source]

Hook method for setting up the test fixture before exercising it.

test_success()[source]

Test success

test_url()[source]
class tests.posts.test_api.TestWebhookPostMediaAPIView(methodName='runTest')[source]

Bases: APITestCase

Test WebhookPostMediaAPIView

setUp() None[source]

Hook method for setting up the test fixture before exercising it.

test_empty_request()[source]
test_success()[source]
test_url()[source]
class tests.posts.test_api.UpdateCommentAPIViewTestCase(methodName='runTest')[source]

Bases: APITestCase

Test class for UpdateCommentAPIView

setUp() None[source]

Hook method for setting up the test fixture before exercising it.

test_comment_not_exists()[source]
test_forbitten()[source]
test_resolve_url()[source]
test_success()[source]
test_unathorize()[source]
test_update_comment_for_deleted_post()[source]
test_update_comment_for_private_post_as_author()[source]
test_update_comment_for_private_post_as_non_author()[source]
test_update_comment_when_commenting_forbidden()[source]
class tests.posts.test_api.UploadPostApiViewTestCase(methodName='runTest')[source]

Bases: APITestCase

pytestmark = [Mark(name='usefixtures', args=('jpg_file',), kwargs={})]
setUp() None[source]

Hook method for setting up the test fixture before exercising it.

test_posts_empty_data()[source]
test_posts_permission_error()[source]
test_posts_upload()[source]
class tests.posts.test_services.CommentServiceTestCase(methodName='runTest')[source]

Bases: TestCase

pytestmark = [Mark(name='usefixtures', args=('jpg_file',), kwargs={})]
setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_create_for_deleted_post()[source]
test_create_for_private_post_as_non_author()[source]
test_create_when_commenting_forbidden()[source]
test_reach_image_limit()[source]
test_update_for_deleted_post()[source]
test_update_for_private_post_as_non_author()[source]
test_update_success()[source]
test_update_when_commenting_forbidden()[source]
class tests.posts.test_services.LikeServiceTestCase(methodName='runTest')[source]

Bases: TestCase

setUp() None[source]

Hook method for setting up the test fixture before exercising it.

test_create()[source]
test_delete()[source]
class tests.posts.test_services.PostCategoryServiceTestCase(methodName='runTest')[source]

Bases: TestCase

setUp() None[source]

Hook method for setting up the test fixture before exercising it.

test_invalid_categories()[source]
test_no_category_change()[source]
test_too_many_categories()[source]
test_valid_categories()[source]
class tests.posts.test_services.PostServiceTestCase(methodName='runTest')[source]

Bases: TestCase

setUp() None[source]

Hook method for setting up the test fixture before exercising it.

test_add_to_favorites()[source]
test_post_delete()[source]
test_post_like_exception()[source]
test_post_unlike_exception()[source]
test_remove_from_favorites()[source]
class tests.posts.test_services.TestFavoriteService(methodName='runTest')[source]

Bases: TestCase

setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_create_existing_favorite()[source]
test_create_new_favorite()[source]
test_delete_existing_favorite()[source]
test_delete_nonexistent_favorite()[source]
class tests.posts.test_services.TestPostCreationService(methodName='runTest')[source]

Bases: TestCase

pytestmark = [Mark(name='usefixtures', args=('jpg_file',), kwargs={})]
setUp() None[source]

Hook method for setting up the test fixture before exercising it.

test_check_high_image() None[source]
test_check_media() None[source]
test_check_status() None[source]
test_check_wide_image() None[source]
test_create() None[source]
test_original_field_update() None[source]
class tests.posts.test_services.TestPostMediaService(methodName='runTest')[source]

Bases: TestCase

Test post media service

setUp() None[source]

Hook method for setting up the test fixture before exercising it.

test_set_formatted_path() None[source]

Test formatted path success case

class tests.posts.test_urls.PostURLsTestCase(methodName='runTest')[source]

Bases: TestCase

classmethod setUpClass()[source]

Hook method for setting up class fixture before running tests in the class.

test_detailed_post_upload_media()[source]
test_detailed_post_url_delete()[source]
test_detailed_post_url_get()[source]
test_detailed_post_url_patch()[source]
test_detailed_post_url_put()[source]
test_post_favorite_add()[source]
test_post_favorites_list()[source]
test_post_following_list()[source]
test_post_for_you_list()[source]
test_post_list_url_get()[source]
test_post_list_url_post()[source]
test_post_media_delete()[source]
test_post_media_get()[source]
test_post_media_put()[source]
test_post_media_update()[source]
class tests.posts.test_serializers.TestCommentSerializer(methodName='runTest')[source]

Bases: TestCase

pytestmark = [Mark(name='usefixtures', args=('jpg_file',), kwargs={})]
setUp() None[source]

Hook method for setting up the test fixture before exercising it.

test_add_only_image()[source]
test_comment_cannot_be_empty()[source]
test_expected_fields()[source]
test_reach_limit_image()[source]
class tests.posts.test_serializers.TestPostContentsSerializer(methodName='runTest')[source]

Bases: TestCase

Test post contents serializer

pytestmark = [Mark(name='usefixtures', args=('mp4_file',), kwargs={}), Mark(name='usefixtures', args=('jpg_file',), kwargs={})]
setUp() None[source]

Hook method for setting up the test fixture before exercising it.

test_expected_fields()[source]
test_upload_mixed_content()[source]
test_upload_too_many_contents()[source]
test_upload_two_video()[source]
test_validate()[source]
class tests.posts.test_serializers.TestPostMediaContentSerializer(methodName='runTest')[source]

Bases: TestCase

Test post media content serializer

pytestmark = [Mark(name='usefixtures', args=('mp4_file',), kwargs={}), Mark(name='usefixtures', args=('invalid_resolution_jpg_file',), kwargs={}), Mark(name='usefixtures', args=('oversize_png_file',), kwargs={}), Mark(name='usefixtures', args=('jpg_file',), kwargs={}), Mark(name='usefixtures', args=('svg_file',), kwargs={})]
setUp() None[source]

Hook method for setting up the test fixture before exercising it.

test_expected_fields()[source]
test_upload_image_invalid_resolution()[source]
test_upload_image_invalid_size()[source]
test_upload_unsupported_format()[source]
test_upload_valid_file()[source]
test_upload_valid_video()[source]
class tests.posts.test_serializers.TestPostNotificationSerializer(methodName='runTest')[source]

Bases: TestCase

Test post notification serializer

setUp() None[source]

Hook method for setting up the test fixture before exercising it.

test_data()[source]
class tests.posts.test_serializers.TestPostSerializer(methodName='runTest')[source]

Bases: TestCase

setUp() None[source]

Hook method for setting up the test fixture before exercising it.

test_expected_fields()[source]
test_hasgtags_determination()[source]
test_hasgtags_with_title_determination()[source]
class tests.posts.test_serializers.TestUpdateCommentSerializer(methodName='runTest')[source]

Bases: TestCase

setUp() None[source]

Hook method for setting up the test fixture before exercising it.

test_data_expected_fields()[source]
class tests.posts.test_serializers.TestWebhookPostSerializer(methodName='runTest')[source]

Bases: TestCase

Test webhook post serializer

setUp() None[source]

Set up method for WebhookPostSerializer

test_expected_fields() None[source]

Test expected fields

test_success() None[source]

Test succes case