Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transaction error 500 when testing transaction with validation error 400 #391

Closed
rmsj opened this issue May 20, 2024 · 2 comments
Closed

Comments

@rmsj
Copy link

rmsj commented May 20, 2024

If a new test is added to the transaction api:

func create400(sd apitest.SeedData) []apitest.Table { table := []apitest.Table{ { Name: "basic", URL: "/v1/tranexample", Token: sd.Admins[0].Token, Method: http.MethodPost, StatusCode: http.StatusBadRequest, Input: &tranapp.NewTran{ Product: tranapp.NewProduct{ Quantity: 10, }, User: tranapp.NewUser{ Name: "Bill Kennedy", Email: "bill@ardanlabs.com", Roles: []string{"ADMIN"}, Department: "IT", Password: "123", PasswordConfirm: "123", }, }, GotResp: &tranapp.Product{}, ExpResp: nil, //TODO, CmpFunc: func(got any, exp any) string { return nil // TODO }, }, } return table }

The error that transaction.go sends is a 500 error, overriding the 400 from the validation.
See transaction.go, line 40

PS.: Sorry, can't get format to behave.

@ardan-bkennedy
Copy link
Contributor

I can reproduce this. Transactions have created all sort of chaos. I am looking into this now. THANKS

@ardan-bkennedy
Copy link
Contributor

Ok, I just pushed a fix. This was a great catch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants