Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor the code, create documentation to code, and update tests (#43)
* chore(.gitignore): add ignore rules for database configuration files in migrations and instance directories test(routes_test.py): refactor test cases to use unittest.TestCase and improve readability test(routes_test.py): add test case to confirm if blueprints were registered test(routes_test.py): add test case to verify if there are no duplicate blueprints registered test(routes_test.py): add test case to check if all registered routes are present test(routes_test.py): add test case to check if all registered endpoints are present test(routes_test.py): add test case to count the number of HTTP verbs registered for routes * fix(routes_test.py): remove unused property 'endpoints' to improve code readability and maintainability fix(routes_test.py): remove unused property 'blueprints' to improve code readability and maintainability refactor(routes_test.py): simplify test_when_blueprints_have_been_registered by directly comparing expected blueprints with actual blueprints refactor(routes_test.py): simplify test_when_not_exists_registered_blueprints by directly comparing expected blueprints with actual blueprints refactor(routes_test.py): simplify test_when_endpoints_have_been_registered by directly comparing expected endpoints with actual endpoints refactor(routes_test.py): simplify test_when_methods_have_been_registered by directly comparing expected methods with actual methods * chore(version): update package version from 2.5.0 to 2.7.0 test(version_test.py): add unit test to verify the updated package version is correct * feat(tests): add conftest.py file for test fixtures and client setup refactor(tests): remove fixtures.py file as it is no longer needed feat(tests): add messages_enpoint_test.py file for testing message endpoints refactor(tests): remove request_test.py file as it is no longer needed * chore(makefile): update test command in makefile to use pytest instead of ward for consistency with other projects chore(makefile): update format command in makefile to use line length limit of 89 characters instead of 79 characters for consistency with other projects chore(makefile): update check command in makefile to use line length limit of 89 characters instead of 79 characters for consistency with other projects chore(pyproject.toml): add flask-sqlalchemy and pytest as dev dependencies for the project * test(routes_test.py): refactor test methods to improve readability and maintainability test(routes_test.py): add assertions to verify that the expected blueprints have been registered test(routes_test.py): add assertions to verify that the expected routes have been registered test(routes_test.py): add assertions to verify that the expected endpoints have been registered * feat(router.py): add Router class for managing routes in a web application The Router class provides methods to define and manage different HTTP routes (GET, POST, PUT, DELETE) for the application's controllers and actions. It includes the following methods: - `_method_route()`: Private method that organizes routes by HTTP method. - `namespace(name: str)`: Static method to create a namespace for routes. - `get(path: str, resource: str)`: Static method to define a GET route. - `post(path: str, resource: str)`: Static method to define a POST route. - `put(path: str, resource: str)`: Static method to define a PUT route. - `delete(path: str, resource: str)`: Static method to define a DELETE route. - `all(resource: str, only=None, base_path="")`: Static method to define routes for all standard RESTful actions for a resource. - `_add_routes(name, actions, base_path)`: Private method to add routes for specified actions under a given name and base path. fix(routes_test.py): remove empty line * test(messages_endpoint_test.py): add tests for checking if blueprints have been registered and if messages routes and endpoints have been registered test(messages_endpoint_test.py): add tests for checking the number of registered routes and their methods test(messages_enpoint_test.py): delete unused test file * chore(routes.py): remove unused route definition for "user" endpoint chore(conftest.py): uncomment and refactor browser fixture to use test_client() and properly handle database session feat(messages_form_test.py): add tests for updating and deleting messages using PUT HTTP method chore(routes_test.py): remove assertion for "user" blueprint in test_when_blueprints_have_been_registered() test * chore(tests): remove outdated version test file test(version_test.py): update version test to use the correct version number * test(messages_endpoint_test.py): remove unnecessary blank line to improve code readability test(version_test.py): remove unnecessary blank line to improve code readability * fix(__init__.py): fix import statement for http_method_override middleware module feat(http_method_override.py): add HTTPMethodOverrideMiddleware and CustomRequest classes to handle HTTP method override functionality * fix(messages_controller.py): refactor update method to handle both JSON and form data for updating message title test(messages_direct_request_test.py): add tests for creating and updating a message using direct requests * chore(posts_controller.py): remove unused methods and add new method to improve code organization and readability chore(user_controller.py): remove unused file to improve code organization and maintainability chore(routes.py): comment out unused routes to improve code organization and maintainability test(messages_endpoint_test copy.py): add tests to ensure proper registration of messages endpoints test(routes_test.py): add tests to ensure proper registration of routes and methods count * chore: bump version to 2.7.1 Bump the version from 2.7.0 to 2.7.1 in __version__.py, pyproject.toml, and version_test.py to reflect the latest changes and improvements in the mvc-flask project.
- Loading branch information