-
Notifications
You must be signed in to change notification settings - Fork 5
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
Refactor the code, create documentation to code, and update tests #43
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…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
…de 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
test(version_test.py): add unit test to verify the updated package version is correct
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
…d 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
…d 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
…ation 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
… 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(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
test(version_test.py): update version test to use the correct version number
…rove code readability test(version_test.py): remove unnecessary blank line to improve code readability
…eware module feat(http_method_override.py): add HTTPMethodOverrideMiddleware and CustomRequest classes to handle HTTP method override functionality
…ON and form data for updating message title test(messages_direct_request_test.py): add tests for creating and updating a message using direct requests
…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
marcuxyz
changed the title
Refactoring/tests
Implement Dynamic Route Handling in Router Class and Create documentation for methods
Nov 12, 2023
marcuxyz
changed the title
Implement Dynamic Route Handling in Router Class and Create documentation for methods
Refactor the code, create documentations to code and update tests
Nov 12, 2023
marcuxyz
changed the title
Refactor the code, create documentations to code and update tests
Refactor the code, create documentation to code, and update tets
Nov 12, 2023
marcuxyz
changed the title
Refactor the code, create documentation to code, and update tets
Refactor the code, create documentation to code, and update tests
Nov 12, 2023
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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Test Improvements and Refactoring:
New test cases were added to validate the registration of blueprints, routes, endpoints, and HTTP verbs.
The tests in routes_test.py were refactored for better readability and maintainability. This included removing unused properties and simplifying tests by directly comparing expected and actual blueprints, routes, and methods.
Version Update and Tests:
The package version was updated from 2.5.0 to 2.7.0, with a corresponding unit test added to verify this change.
Test Setup and File Management:
A conftest.py file was added for test fixtures and client setup, replacing the fixtures.py file. Additionally, the messages_endpoint_test.py file was added for testing message endpoints, while the request_test.py file was removed.
Makefile and Dependency Updates:
The Makefile was updated to use pytest instead of ward and to change the line length limit to 89 characters for consistency. Flask-SQLAlchemy and pytest were added as dev dependencies.
Router Class Addition:
A Router class was added to manage different HTTP routes (GET, POST, PUT, DELETE) for the application's controllers and actions.
Additional Test Cases and Cleanup:
New tests were added for checking blueprints registration, message routes, and endpoints. Unnecessary blank lines were removed to improve code readability. Tests were also added to ensure proper registration of routes and methods count.
HTTP Method Override Functionality:
The http_method_override.py file was added to handle HTTP method override functionality with new HTTPMethodOverrideMiddleware and CustomRequest classes.
Controller and Route Management:
The messages_controller.py was refactored to handle both JSON and form data for updating message titles. Unused methods and files in the controllers were removed, and new methods were added to improve code organization and readability.
Close #42