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
Feature add tests #1
Merged
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
- Added `models_for_test.py` file with `Parent` and `Child` classes. - Created a new table called `parents_to_children` to establish a many-to-many relationship between parents and children. - Updated the `test_crud.py` file to import the newly added models (`Parent`, `Child`, and `Base`) from `models_for_test.py`. - Added test data creation methods (`create_test_data()` and `link_children_to_parents()`) to populate the database with parent and child records. - Modified existing tests in the `TestGetModels` class to use the new models (`Parent`) instead of the old model (`TestModel`).
This commit adds black and pylint as dev dependencies in the pyproject.toml file. The pytest version is also updated to "^7.4.0". fix: Fix newline at end of file This commit fixes the missing newline at the end of the models_for_test.py file. refactor: Refactor test_crud.py This commit refactors the test_crud.py file by removing unused variables, fixing indentation, and improving code readability.
- Added a new column `id_modulo` of type Integer to the Parent model in `models_for_test.py`. feat: Import additional functions and classes for testing CRUD operations - Imported the following functions and classes from `sqlalchemy_crud.crud` module: - get_model - get_model_by_attribute - get_models_by_attribute - create_model - update_model - delete_model - link_models - unlink_models - These imports are necessary for testing CRUD operations in the `test_crud.py` file. feat: Update test_get_models_with_default_offset_and_limit method - Updated the `test_get_models_with_default_offset_and_limit` method in `test_crud.py`. - The method now creates test data with an additional attribute, `id_modulo`, for each parent. - The test checks if the models returned by calling `get_models` have the expected names and attributes. feat: Add tests for relationship handling in CRUD operations - Added tests for relationship handling in CRUD operations. - Tests include: * Retrieving models with relationships using `get_models` * Retrieving a single model with relationships using `get_model` * Retrieving a single model by attribute value with relationships using `get_model_by_attribute` * Retrieving multiple models by attribute value with relationships using `get_models_by_attribute` * Creating a new model with relationships using `create_model` * Updating an existing model with relationships using `update_model` * Deleting a model with relationships using 'delete_model' * Linking two models together using 'link_models' fix: Fix typo in link_children_to_parents method - Fixed a typo in the loop range of the 'link_children_to_parents' method.
…s by attribute with invalid attributes. - Added coverage and pytest-cov dependencies to pyproject.toml. - Added test_get_model_by_attribute_with_invalid_attribute() method to test_crud.py. - Added test_get_models_by_attribute_with_invalid_attribute() method to test_crud.py.
- Refactored the import statements to group related functions together - Split long lines of code into multiple lines for improved readability - Reorganized the order of function definitions in the test class - Added more detailed comments to explain the purpose of each test case
- Removed unnecessary import statement from `sqlalchemy_crud/crud.py` - Reordered import statements in `tests/models_for_test.py` - Removed unused import statement from `tests/test_crud.py`
- Added a new workflow file `poetry-pytest.yml` for running tests using Poetry and pytest. - Configured the workflow to run on pushes to the `main` branch and pull requests targeting the `main` branch. - Set up the job to run on Ubuntu latest version. - Added steps to checkout the code, set up Python 3.8, install Poetry, cache dependencies, and run tests using pytest. Updated an existing workflow file `pylint.yml`. - Commented out the entire content of the file as it was not being used. Note: No specific names or files from the code were mentioned in this commit message.
Added a Pytest badge to the README.md file. The badge displays the status of the Pytest workflow for this project.
This commit renames the file dependabot.yml to workflows/dependabot.yml. This change was made to improve the organization and structure of the codebase.
This commit renames the dependabot.yml file to .github/dependabot.yml. This change improves the organization of the repository by moving the file to a more appropriate location.
The commit updates the README.md file by replacing the old badge link with a new one. The new badge link points to the GitHub Actions workflow for poetry-pytest.yml.
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.
No description provided.