-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
테스트: 유저생성 api 테스트 이메일 중복 오류 및 ImageField 해결
- Loading branch information
Showing
3 changed files
with
32 additions
and
35 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 |
---|---|---|
|
@@ -48,32 +48,29 @@ def test_유저_생성시_transaction_callback_및_메일전송_확인( | |
assert mail.outbox[0].subject == EMAIL_VERIFY_TITLE | ||
|
||
|
||
def test_유저_생성시_프로필_이미지_업로드_레코드_생성_및_시리얼라이저_데이터_반환(client: Client): | ||
|
||
user = UserFactory.create(email="[email protected]") | ||
|
||
user_image = UserProfileImageFactory.create() | ||
def test_유저_생성시_프로필_이미지_업로드_레코드_생성_및_시리얼라이저_데이터_반환( | ||
client: Client, create_user_data: Callable, get_test_image | ||
): | ||
|
||
data = { | ||
"email": user.email, | ||
"password": user.password, | ||
"nickname": user.nickname, | ||
"bio": user.bio, | ||
} | ||
user = UserFactory.build() | ||
|
||
data.update({"img": user_image.img}) | ||
data = create_user_data(user) | ||
data.update({"img": get_test_image}) | ||
|
||
res = client.post( | ||
reverse("account:v1:signup"), data=data, media_type="multipart/form-data" | ||
) | ||
|
||
assert res.data is None | ||
assert res.status_code == status.HTTP_201_CREATED | ||
assert res.data["user"]["email"] == user.email | ||
assert UserProfileImage.objects.filter(user=user).exists() is True | ||
assert ( | ||
UserProfileImage.objects.filter(user_id=res.data["user"]["id"]).exists() is True | ||
) | ||
assert ( | ||
res.data["user"]["profile_image"] | ||
== UserProfileImage.objects.get(user_id=user.id).img | ||
== UserProfileImage.objects.filter(user_id=res.data["user"]["id"]) | ||
.first() | ||
.img.url | ||
) | ||
|
||
|
||
|