Created
May 18, 2023 05:32
-
-
Save pimiento/4041d711848a5634cf2f13d6e88a3a2d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
============================= test session starts ============================== | |
platform linux -- Python 3.10.11, pytest-7.1.3, pluggy-1.0.0 -- /home/pimiento/yap/peschanov-django-sprint4/venv/bin/python3.10 | |
django: settings: blogicum.settings (from ini) | |
rootdir: /home/pimiento/yap/peschanov-django-sprint4, configfile: pytest.ini | |
plugins: Faker-12.0.1, django-4.5.2 | |
collecting ... collected 5 items | |
tests/test_content.py::TestContent::test_unpublished FAILED [ 20%] | |
tests/test_content.py::TestContent::test_unpublished_category FAILED [ 40%] | |
tests/test_content.py::TestContent::test_future_posts FAILED [ 60%] | |
tests/test_content.py::TestContent::test_pagination FAILED [ 80%] | |
tests/test_content.py::TestContent::test_image_visible PASSED [100%] | |
=================================== FAILURES =================================== | |
_________________________ TestContent.test_unpublished _________________________ | |
self = <test_content.TestContent object at 0x7fa96bfd8e50> | |
unpublished_posts_with_published_locations = [<Post: Actually Space Fast >, <Post: Scene Them Listen Pa>, <Post: Section Training Int>] | |
def test_unpublished( | |
self, unpublished_posts_with_published_locations): | |
profile_response = self.profile_tester.user_client_testget() | |
context_posts = profile_response.context.get( | |
self.profile_tester.items_key) | |
expected_n = self.profile_tester.n_or_page_size( | |
len(unpublished_posts_with_published_locations)) | |
> assert len(context_posts) == expected_n, ( | |
f'Убедитесь, что {self.profile_tester.on_which_page} ' | |
'авторизованному пользователю отображаются ' | |
f'{self.profile_tester.which_objs}, снятые с публикации.' | |
) | |
E TypeError: object of type 'NoneType' has no len() | |
tests/test_content.py:305: TypeError | |
---------------------------- Captured stdout setup ----------------------------- | |
Operations to perform: | |
Synchronize unmigrated apps: django_bootstrap5, messages, staticfiles | |
Apply all migrations: admin, auth, blog, contenttypes, sessions | |
Synchronizing apps without migrations: | |
Creating tables... | |
Running deferred SQL... | |
Running migrations: | |
Applying contenttypes.0001_initial... OK | |
Applying auth.0001_initial... OK | |
Applying admin.0001_initial... OK | |
Applying admin.0002_logentry_remove_auto_add... OK | |
Applying admin.0003_logentry_add_action_flag_choices... OK | |
Applying contenttypes.0002_remove_content_type_name... OK | |
Applying auth.0002_alter_permission_name_max_length... OK | |
Applying auth.0003_alter_user_email_max_length... OK | |
Applying auth.0004_alter_user_username_opts... OK | |
Applying auth.0005_alter_user_last_login_null... OK | |
Applying auth.0006_require_contenttypes_0002... OK | |
Applying auth.0007_alter_validators_add_error_messages... OK | |
Applying auth.0008_alter_user_username_max_length... OK | |
Applying auth.0009_alter_user_last_name_max_length... OK | |
Applying auth.0010_alter_group_name_max_length... OK | |
Applying auth.0011_update_proxy_permissions... OK | |
Applying auth.0012_alter_user_first_name_max_length... OK | |
Applying blog.0001_initial... OK | |
Applying blog.0002_auto_20230513_1846... OK | |
Applying blog.0003_comment... OK | |
Applying blog.0004_comment_author... OK | |
Applying blog.0005_rename_post_comment_post_id... OK | |
Applying blog.0006_rename_post_id_comment_post... OK | |
Applying sessions.0001_initial... OK | |
---------------------------- Captured stderr setup ----------------------------- | |
Creating test database for alias 'default' ('file:memorydb_default?mode=memory&cache=shared')... | |
____________________ TestContent.test_unpublished_category _____________________ | |
self = <test_content.TestContent object at 0x7fa96bfd8d00> | |
user_client = <django.test.client.Client object at 0x7fa96bb978e0> | |
posts_with_unpublished_category = [<Post: Adult Energy Deal Ma>, <Post: Protect Gun Note Als>, <Post: Occur Travel Time Ab>] | |
def test_unpublished_category( | |
self, user_client, posts_with_unpublished_category | |
): | |
profile_response = self.profile_tester.user_client_testget() | |
context_posts = profile_response.context.get( | |
self.profile_tester.items_key) | |
expected_n = self.profile_tester.n_or_page_size( | |
len(posts_with_unpublished_category)) | |
> assert len(context_posts) == expected_n, ( | |
f'Убедитесь, что {self.profile_tester.on_which_page} ' | |
'авторизованному пользователю отображаются ' | |
f'{self.profile_tester.which_objs} категории, снятой с публикации.' | |
) | |
E TypeError: object of type 'NoneType' has no len() | |
tests/test_content.py:327: TypeError | |
________________________ TestContent.test_future_posts _________________________ | |
self = <test_content.TestContent object at 0x7fa96bfd93f0> | |
user_client = <django.test.client.Client object at 0x7fa96ba4f460> | |
future_posts = [<Post: Together Firm Collec>, <Post: Effort Develop Tough>, <Post: Finally Job Long Tel>] | |
def test_future_posts(self, user_client, future_posts): | |
profile_response = self.profile_tester.user_client_testget() | |
context_posts = profile_response.context.get( | |
self.profile_tester.items_key) | |
expected_n = self.profile_tester.n_or_page_size(len(future_posts)) | |
> assert len(context_posts) == expected_n, ( | |
f'Убедитесь, что {self.profile_tester.on_which_page} ' | |
'авторизованному пользователю отображаются отложенные ' | |
f'{self.profile_tester.which_objs}.') | |
E TypeError: object of type 'NoneType' has no len() | |
tests/test_content.py:355: TypeError | |
_________________________ TestContent.test_pagination __________________________ | |
self = <test_content.TestContent object at 0x7fa96bfd9990> | |
user_client = <django.test.client.Client object at 0x7fa96bb96b90> | |
many_posts_with_published_locations = [<Post: Police Suddenly Arri>, <Post: Adult Relate Sit Bel>, <Post: Plan Wait East Artis>, <Post: Heart Close Bag On E>, <Post: Final Six Education >, <Post: Decide Him Learn Sea>, ...] | |
def test_pagination(self, user_client, | |
many_posts_with_published_locations): | |
posts = many_posts_with_published_locations | |
assert len(posts) > self.profile_tester.n_per_page | |
assert len(posts) > self.main_tester.n_per_page | |
assert len(posts) > self.category_tester.n_per_page | |
for tester in ( | |
self.profile_tester, self.main_tester, self.category_tester): | |
response = tester.user_client_testget() | |
context_posts = response.context.get(tester.items_key) | |
expected_n = tester.n_or_page_size(len(posts)) | |
> assert len(context_posts) == expected_n, ( | |
f'Убедитесь, что {tester.on_which_page} работает пагинация.') | |
E TypeError: object of type 'NoneType' has no len() | |
tests/test_content.py:380: TypeError | |
=========================== short test summary info ============================ | |
FAILED tests/test_content.py::TestContent::test_unpublished - TypeError: obje... | |
FAILED tests/test_content.py::TestContent::test_unpublished_category - TypeEr... | |
FAILED tests/test_content.py::TestContent::test_future_posts - TypeError: obj... | |
FAILED tests/test_content.py::TestContent::test_pagination - TypeError: objec... | |
=================== 4 failed, 1 passed, 8 warnings in 1.33s ==================== |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment