Is your API is out of control? Is testing getting harder? Then get APIAssure! It's very easy to use!
- Clone APIAssure.
git clone https://github.com/ErolGelbul/api_assure.git
- Create secrets inside <secrets.ini>:
APP_URL=http://host.docker.internal:8080
ADMIN_USER=admin
ADMIN_PASSWORD=admin
- Start development server:
make dev
- Logging
- Automated end to end scenarios. (decent boilerplate)
- Pytest Fixtures
The build_request_headers function is used to build a dictionary containing the necessary headers for making API requests, such as the Authorization and accept headers. It can also include a Content-Type header if specified in the function's arguments.
CRUD operation on Users.
The users.py file defines a Users class that provides methods for interacting with the user-related endpoints of an API. The class contains the following methods:
- get_all_users: Retrieves a list of all users.
- create_user: Creates a new user with a specified username, password, and role.
- get_current_user: Gets information about the currently authenticated user.
- delete_user: Deletes a user with a specified user ID.
These methods make HTTP requests to the API using the provided app_url, access_token, and other necessary parameters. The build_request_headers function from lib.utils is used to generate the required headers for each request. The SESSION object from the config module is used to manage the HTTP requests.
Contains the login_as_admin Pytest fixture, which logs in as an admin user and provides an access token for use in test functions. The fixture has a session scope, meaning it's executed only once per test session. To use this fixture, include it as a parameter in your test functions, which will then have access to the admin user's access token.
If you would like to add any extra features to the optimisation simulation, feel free to fork and create a pull request. Thank you!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Erol Gelbul - Website
Project Link: APIAssure