1- package controller_test
1+ package controller
22
33import (
44 "context"
@@ -14,7 +14,6 @@ import (
1414 "github.com/steveiliop56/ding"
1515 "github.com/stretchr/testify/assert"
1616 "github.com/stretchr/testify/require"
17- "github.com/tinyauthapp/tinyauth/internal/controller"
1817 "github.com/tinyauthapp/tinyauth/internal/model"
1918 "github.com/tinyauthapp/tinyauth/internal/repository"
2019 "github.com/tinyauthapp/tinyauth/internal/repository/memory"
@@ -86,7 +85,7 @@ func TestUserController(t *testing.T) {
8685 description : "Should be able to login with valid credentials" ,
8786 middlewares : []gin.HandlerFunc {},
8887 run : func (t * testing.T , router * gin.Engine , recorder * httptest.ResponseRecorder ) {
89- loginReq := controller. LoginRequest {
88+ loginReq := LoginRequest {
9089 Username : "testuser" ,
9190 Password : "password" ,
9291 }
@@ -114,7 +113,7 @@ func TestUserController(t *testing.T) {
114113 description : "Should reject login with invalid credentials" ,
115114 middlewares : []gin.HandlerFunc {},
116115 run : func (t * testing.T , router * gin.Engine , recorder * httptest.ResponseRecorder ) {
117- loginReq := controller. LoginRequest {
116+ loginReq := LoginRequest {
118117 Username : "testuser" ,
119118 Password : "wrongpassword" ,
120119 }
@@ -135,7 +134,7 @@ func TestUserController(t *testing.T) {
135134 description : "Should rate limit on 3 invalid attempts" ,
136135 middlewares : []gin.HandlerFunc {},
137136 run : func (t * testing.T , router * gin.Engine , recorder * httptest.ResponseRecorder ) {
138- loginReq := controller. LoginRequest {
137+ loginReq := LoginRequest {
139138 Username : "testuser" ,
140139 Password : "wrongpassword" ,
141140 }
@@ -170,7 +169,7 @@ func TestUserController(t *testing.T) {
170169 description : "Should not allow full login with totp" ,
171170 middlewares : []gin.HandlerFunc {},
172171 run : func (t * testing.T , router * gin.Engine , recorder * httptest.ResponseRecorder ) {
173- loginReq := controller. LoginRequest {
172+ loginReq := LoginRequest {
174173 Username : "totpuser" ,
175174 Password : "password" ,
176175 }
@@ -207,7 +206,7 @@ func TestUserController(t *testing.T) {
207206 },
208207 run : func (t * testing.T , router * gin.Engine , recorder * httptest.ResponseRecorder ) {
209208 // First login to get a session cookie
210- loginReq := controller. LoginRequest {
209+ loginReq := LoginRequest {
211210 Username : "testuser" ,
212211 Password : "password" ,
213212 }
@@ -264,7 +263,7 @@ func TestUserController(t *testing.T) {
264263 code , err := totp .GenerateCode ("JPIEBDKJH6UGWJMX66RR3S55UFP2SGKK" , time .Now ())
265264 require .NoError (t , err )
266265
267- totpReq := controller. TotpRequest {
266+ totpReq := TotpRequest {
268267 Code : code ,
269268 }
270269
@@ -302,7 +301,7 @@ func TestUserController(t *testing.T) {
302301 },
303302 run : func (t * testing.T , router * gin.Engine , recorder * httptest.ResponseRecorder ) {
304303 for range 3 {
305- totpReq := controller. TotpRequest {
304+ totpReq := TotpRequest {
306305 Code : "000000" , // invalid code
307306 }
308307
@@ -334,7 +333,7 @@ func TestUserController(t *testing.T) {
334333 description : "Login uses name and email from user attributes" ,
335334 middlewares : []gin.HandlerFunc {},
336335 run : func (t * testing.T , router * gin.Engine , recorder * httptest.ResponseRecorder ) {
337- loginReq := controller. LoginRequest {Username : "attruser" , Password : "password" }
336+ loginReq := LoginRequest {Username : "attruser" , Password : "password" }
338337 body , err := json .Marshal (loginReq )
339338 require .NoError (t , err )
340339
@@ -352,7 +351,7 @@ func TestUserController(t *testing.T) {
352351 description : "Login with TOTP uses name and email from user attributes in pending session" ,
353352 middlewares : []gin.HandlerFunc {},
354353 run : func (t * testing.T , router * gin.Engine , recorder * httptest.ResponseRecorder ) {
355- loginReq := controller. LoginRequest {Username : "attrtotpuser" , Password : "password" }
354+ loginReq := LoginRequest {Username : "attrtotpuser" , Password : "password" }
356355 body , err := json .Marshal (loginReq )
357356 require .NoError (t , err )
358357
@@ -388,7 +387,7 @@ func TestUserController(t *testing.T) {
388387 code , err := totp .GenerateCode ("JPIEBDKJH6UGWJMX66RR3S55UFP2SGKK" , time .Now ())
389388 require .NoError (t , err )
390389
391- totpReq := controller. TotpRequest {Code : code }
390+ totpReq := TotpRequest {Code : code }
392391 body , err := json .Marshal (totpReq )
393392 require .NoError (t , err )
394393
@@ -455,7 +454,7 @@ func TestUserController(t *testing.T) {
455454 group := router .Group ("/api" )
456455 gin .SetMode (gin .TestMode )
457456
458- controller . NewUserController (controller. UserControllerInput {
457+ NewUserController (UserControllerInput {
459458 Log : log ,
460459 RuntimeConfig : & runtime ,
461460 RouterGroup : group ,
0 commit comments