Skip to content

Commit a5b4a6f

Browse files
committed
Minor change
1 parent 8795a7b commit a5b4a6f

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

tests/test_profile.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22

3+
from fastapi import status
34
from PIL import Image
45
import pytest
56

@@ -31,7 +32,7 @@ def test_get_image_crop_area(width, height, result):
3132
def test_profile_page(profile_test_client):
3233
profile = profile_test_client.get('/profile')
3334
data = profile.content
34-
assert profile.status_code == 200
35+
assert profile.ok
3536
assert b'profile.png' in data
3637
assert b'FakeName' in data
3738
assert b'Happy new user!' in data
@@ -47,7 +48,7 @@ def test_update_user_fullname(profile_test_client):
4748
# Post new data
4849
profile = profile_test_client.post(
4950
'/profile/update_user_fullname', data=new_name_data)
50-
assert profile.status_code == 302
51+
assert profile.status_code == status.HTTP_302_FOUND
5152

5253
# Get updated data
5354
data = profile_test_client.get('/profile').content
@@ -64,7 +65,7 @@ def test_update_user_email(profile_test_client):
6465
# Post new data
6566
profile = profile_test_client.post(
6667
'/profile/update_user_email', data=new_email)
67-
assert profile.status_code == 302
68+
assert profile.status_code == status.HTTP_302_FOUND
6869

6970
# Get updated data
7071
data = profile_test_client.get('/profile').content
@@ -81,7 +82,7 @@ def test_update_user_description(profile_test_client):
8182
# Post new data
8283
profile = profile_test_client.post(
8384
'/profile/update_user_description', data=new_description)
84-
assert profile.status_code == 302
85+
assert profile.status_code == status.HTTP_302_FOUND
8586

8687
# Get updated data
8788
data = profile_test_client.get('/profile').content
@@ -98,7 +99,7 @@ def test_update_telegram_id(profile_test_client):
9899
# Post new data
99100
profile = profile_test_client.post(
100101
'/profile/update_telegram_id', data=new_telegram_id)
101-
assert profile.status_code == 302
102+
assert profile.status_code == status.HTTP_302_FOUND
102103

103104
# Get updated data
104105
data = profile_test_client.get('/profile').content
@@ -116,7 +117,7 @@ def test_upload_user_photo(profile_test_client):
116117
'/profile/upload_user_photo',
117118
files={'file': (
118119
"filename", open(example_new_photo, "rb"), "image/png")})
119-
assert profile.status_code == 302
120+
assert profile.status_code == status.HTTP_302_FOUND
120121

121122
# Validate new picture saved in media directory
122123
assert 'fake_user.png' in os.listdir(MEDIA_PATH)

0 commit comments

Comments
 (0)