@@ -28,6 +28,60 @@ def test_signup(client: TestClient, session: Session, user_data: UserBase):
28
28
assert user .nickname == data .nickname
29
29
30
30
31
+ def test_signup_starting_with_number (client : TestClient , session : Session ):
32
+ data = SignupInput (
33
+ username = "123user" ,
34
+ password = "123P@ss!" ,
35
+ password_confirm = "123P@ss!" ,
36
+
37
+ nickname = "123닉네임" ,
38
+ )
39
+
40
+ response = client .post ("/auth/signup" , json = data .dict ())
41
+
42
+ assert response .status_code == 201
43
+
44
+ user = session .query (User ).filter_by (username = data .username ).first ()
45
+
46
+ assert user .username == data .username
47
+ assert user .email == data .email
48
+ assert user .nickname == data .nickname
49
+
50
+
51
+ def test_signup_with_special_password (client : TestClient , session : Session ):
52
+ data = SignupInput (
53
+ username = "testuser" ,
54
+ password = "P@ssw0rd!" ,
55
+ password_confirm = "P@ssw0rd!" ,
56
+
57
+ nickname = "닉네임_!@#$%" ,
58
+ )
59
+
60
+ response = client .post ("/auth/signup" , json = data .dict ())
61
+
62
+ assert response .status_code == 201
63
+
64
+ user = session .query (User ).filter_by (username = data .username ).first ()
65
+
66
+ assert user .username == data .username
67
+ assert user .email == data .email
68
+ assert user .nickname == data .nickname
69
+
70
+
71
+ def test_signup_with_special_character_in_username_fails (client : TestClient ):
72
+ data = dict (
73
+ username = "test!user" ,
74
+ password = "password123" ,
75
+ password_confirm = "password123" ,
76
+
77
+ nickname = "테스트유저" ,
78
+ )
79
+
80
+ response = client .post ("/auth/signup" , json = data )
81
+
82
+ assert response .status_code == 422
83
+
84
+
31
85
def test_login (client : TestClient , user_data : UserBase , add_user : User ):
32
86
data = dict (
33
87
username = add_user .username ,
0 commit comments