This repository has been archived by the owner on Mar 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- valid login - format string favourite picture - redirect user update template
- Loading branch information
aapetrushkin
committed
Sep 18, 2023
1 parent
44276ad
commit 2e15615
Showing
4 changed files
with
44 additions
and
2 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from http import HTTPStatus | ||
from typing import TYPE_CHECKING | ||
|
||
import pytest | ||
from django.urls import reverse | ||
|
||
if TYPE_CHECKING: | ||
from django.test import Client | ||
|
||
from server.apps.identity.models import User | ||
|
||
|
||
@pytest.mark.django_db() | ||
def test_user_update_template( | ||
client: 'Client', | ||
create_user: 'User', | ||
) -> None: | ||
"""Test get template for update user.""" | ||
client.force_login(create_user) | ||
response = client.get(reverse('identity:user_update')) | ||
|
||
assert response.status_code == HTTPStatus.OK | ||
assert 'Редактировать профиль'.encode('utf-8') in response.content |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import pytest | ||
|
||
from server.apps.pictures.models import FavouritePicture | ||
|
||
favourite_picture_params = [ | ||
(1234567890, 'some_test_foreign_id'), | ||
(1234567890, None), | ||
(None, 'some_test_foreign_id'), | ||
(None, None), | ||
] | ||
|
||
|
||
@pytest.mark.parametrize(('foreign_id', 'user_id'), favourite_picture_params) | ||
@pytest.mark.django_db() | ||
def test_output_correct_str(foreign_id, user_id): | ||
"""Test that string representation is correct.""" | ||
string_format = FavouritePicture(foreign_id=foreign_id, user_id=user_id) | ||
|
||
assert str(string_format) == f'<Picture {foreign_id} by {user_id}>' |