9
9
"allaboutapps.dev/aw/go-starter/internal/api/httperrors"
10
10
"allaboutapps.dev/aw/go-starter/internal/models"
11
11
"allaboutapps.dev/aw/go-starter/internal/test"
12
+ "allaboutapps.dev/aw/go-starter/internal/test/fixtures"
12
13
"github.com/labstack/echo/v4"
13
14
"github.com/stretchr/testify/require"
14
15
"github.com/volatiletech/null/v8"
@@ -50,13 +51,13 @@ func assertUserAndRelatedData(ctx context.Context, s *api.Server, t *testing.T,
50
51
func TestDeleteUserAccount (t * testing.T ) {
51
52
test .WithTestServer (t , func (s * api.Server ) {
52
53
ctx := context .Background ()
53
- fix := test .Fixtures ()
54
+ fix := fixtures .Fixtures ()
54
55
55
56
// expect the user to have a app user profile and different kinds of tokens (access, refresh, push, password reset)
56
57
assertUserAndRelatedData (ctx , s , t , fix .User1 .ID , true )
57
58
58
59
payload := test.GenericPayload {
59
- "currentPassword" : test .PlainTestUserPassword ,
60
+ "currentPassword" : fixtures .PlainTestUserPassword ,
60
61
}
61
62
62
63
res := test .PerformRequest (t , s , "DELETE" , "/api/v1/auth/account" , payload , test .HeadersWithAuth (t , fix .User1AccessToken1 .Token ))
@@ -69,7 +70,7 @@ func TestDeleteUserAccount(t *testing.T) {
69
70
70
71
func TestDeleteUserAccountCurrentPasswordWrong (t * testing.T ) {
71
72
test .WithTestServer (t , func (s * api.Server ) {
72
- fix := test .Fixtures ()
73
+ fix := fixtures .Fixtures ()
73
74
74
75
payload := test.GenericPayload {
75
76
"currentPassword" : "wrongpassword" ,
@@ -82,7 +83,7 @@ func TestDeleteUserAccountCurrentPasswordWrong(t *testing.T) {
82
83
83
84
func TestDeleteUserAccountMissingCurrentPassword (t * testing.T ) {
84
85
test .WithTestServer (t , func (s * api.Server ) {
85
- fix := test .Fixtures ()
86
+ fix := fixtures .Fixtures ()
86
87
87
88
res := test .PerformRequest (t , s , "DELETE" , "/api/v1/auth/account" , nil , test .HeadersWithAuth (t , fix .User1AccessToken1 .Token ))
88
89
require .Equal (t , http .StatusBadRequest , res .Result ().StatusCode )
@@ -98,7 +99,7 @@ func TestDeleteUserAccountNoAuth(t *testing.T) {
98
99
99
100
func TestDeleteUserAccountUserNotActive (t * testing.T ) {
100
101
test .WithTestServer (t , func (s * api.Server ) {
101
- fix := test .Fixtures ()
102
+ fix := fixtures .Fixtures ()
102
103
ctx := context .Background ()
103
104
104
105
fix .User1 .IsActive = false
@@ -116,7 +117,7 @@ func TestDeleteUserAccountUserNotActive(t *testing.T) {
116
117
117
118
func TestDeleteUserAccountUserNotLocal (t * testing.T ) {
118
119
test .WithTestServer (t , func (s * api.Server ) {
119
- fix := test .Fixtures ()
120
+ fix := fixtures .Fixtures ()
120
121
ctx := context .Background ()
121
122
122
123
fix .User1 .Password = null.String {}
0 commit comments