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

tests: define assert_forbidden and assert_not_found for any response #6585

Closed
wants to merge 1 commit into from

Conversation

LawnGnome
Copy link
Contributor

The existing uses of these functions meant that uses of get and post didn't have to explicitly turbofish into (), but defining them this way means they can't be used on other responses (for example, the ones returned from yank and unyank). Moving the definitions into Response<T> means we can now use these assertion helpers on any response type, at the cost of having some more turbofish.

(This is obviously a prep PR for the PR I'll be opening Real Soon Now for the admin-minininja branch. The more I can move out of that PR, the better.)

The existing uses of these functions meant that uses of `get` and `post`
didn't have to explicitly turbofish into `()`, but defining them this
way means they can't be used on other responses (for example, the ones
returned from `yank` and `unyank`). Moving the definitions into
`Response<T>` means we can now use these assertion helpers on any
response type, at the cost of having some more turbofish.
@LawnGnome LawnGnome added the C-internal 🔧 Category: Nonessential work that would make the codebase more consistent or clear label Jun 7, 2023
@LawnGnome LawnGnome requested a review from Turbo87 June 7, 2023 22:48
Copy link
Member

@Turbo87 Turbo87 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems fine to me.

I personally prefer using the raw assert_eq!(response.status(), StatusCode::NOT_FOUND); assertions though. not that many more characters, but one less layer of abstraction.

@Turbo87
Copy link
Member

Turbo87 commented Mar 6, 2024

since #6811 was closed I suppose we can close this one too? :)

@Turbo87 Turbo87 closed this Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-backend ⚙️ C-internal 🔧 Category: Nonessential work that would make the codebase more consistent or clear
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants