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

API overhaul: add tests for the API #142

Closed
Tracked by #141
josecelano opened this issue Dec 23, 2022 · 1 comment · Fixed by #149
Closed
Tracked by #141

API overhaul: add tests for the API #142

josecelano opened this issue Dec 23, 2022 · 1 comment · Fixed by #149
Labels
Code Cleanup / Refactoring Tidying and Making Neat Quality & Assurance Relates to QA, Testing, and CI

Comments

@josecelano
Copy link
Member

Parent issue: #141

  • Keep the current API behaviour: URLs and response codes.
  • Write tests for all endpoints and all cases for each endpoint.
  • Refactor to use one struct for each error (rejection). See this PR.
@josecelano josecelano added Code Cleanup / Refactoring Tidying and Making Neat Quality & Assurance Relates to QA, Testing, and CI labels Dec 23, 2022
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Dec 23, 2022
@josecelano josecelano linked a pull request Dec 23, 2022 that will close this issue
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Dec 23, 2022
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Dec 23, 2022
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Dec 23, 2022
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Dec 30, 2022
@josecelano
Copy link
Member Author

hi @da2ce7 @WarmBeer,

We use a token query parameter in the current API version to authenticate API users.
In our case (machine-to-machine communication), I think it's not a good option. Do you want me to use a header in the new version?

From:

curl -X POST http://127.0.0.1:1212/api/key/120?token=MyAccessToken

To:

curl -H 'Authorization: token my_access_token' -X POST http://127.0.0.1:1212/api/key/120

Links

josecelano added a commit to josecelano/torrust-tracker that referenced this issue Dec 30, 2022
josecelano added a commit that referenced this issue Jan 2, 2023
11259e8 test(api): [#142] improved api test coverage (Jose Celano)
07364f4 refactor: [#142] extract functions in test api Client (Jose Celano)
3422e93 refactor: [#142] clean api tests (Jose Celano)
68d521e refactor: [#142] simplify test api server (Jose Celano)
96f386c refactor: [#142] reorganize tests for the API (Jose Celano)

Pull request description:

  Added some tests to the API before changing the web framework to Axum.

ACKs for top commit:
  josecelano:
    ACK 11259e8

Tree-SHA512: 1db52b23df004ccaf693c79cf4a2f98cd93997ad1834419486872031f1994d981488750b444ec0f406b288ffcdebd975428471dbdfb64136bc971e0699c29145
josecelano added a commit to josecelano/torrust-tracker that referenced this issue Jan 3, 2023
@josecelano josecelano changed the title Add tests for the API API overhaul: add tests for the API Mar 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code Cleanup / Refactoring Tidying and Making Neat Quality & Assurance Relates to QA, Testing, and CI
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant