Skip to content

Commit

Permalink
테스트: Login API 테스트
Browse files Browse the repository at this point in the history
  • Loading branch information
Sahayana committed Sep 30, 2023
1 parent be52088 commit e8a0353
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tests/account/v1/apis/test_user_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,30 @@ def test_유저_인증_실패시_인증실패_메시지_반환(client: Client):

assert res.status_code == status.HTTP_400_BAD_REQUEST
assert res.data["msg"] == "not_activated"


def test_로그인_페이지_렌더링(client: Client):

res = client.get(reverse("account:v1:login"))

assert res.status_code == status.HTTP_200_OK
assert "account/login.html" in [template.name for template in res.templates]


def test_로그인_성공시_access_token_반환(client: Client):

email = "[email protected]"
password = "alaltalk!"

user = UserFactory.create(email=email, password=password)
user.is_active = True
user.save()

data = {"email": email, "password": password}

res = client.post(
reverse("account:v1:login"), data=data, content_type="application/json"
)

assert res.status_code == status.HTTP_200_OK
assert res.data is not None

0 comments on commit e8a0353

Please sign in to comment.