Skip to content

Implement advanced filter configs #204

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

Conversation

doubledare704
Copy link
Contributor

Adds a new pytest fixture that creates a test client with predefined filter configurations (tier_id, name, name__startswith) to test filtered endpoints

Pull Request Template for FastCRUD

Description

I've added changes like author mentioned in #196

Changes

Endpoint Creator now has extended logic in _validate_filter_config, but it waits for developer to add filters in FilterConfig, or like Simon did in generate_filter_configs.

Tests

I've added test case to filter by startwith name, 1 positive case, 1 negative case.

Checklist

  • [x ] I have read the CONTRIBUTING document.
  • [x ] My code follows the code style of this project.
  • I have added necessary documentation (if appropriate).
  • [x ] I have added tests that cover my changes (if applicable).
  • [x ] All new and existing tests passed.

Additional Notes

Include any additional information that you think is important for reviewers to know.

Adds a new pytest fixture that creates a test client with predefined filter
configurations (tier_id, name, name__startswith) to test filtered endpoints
@igorbenav
Copy link
Collaborator

@Simon128 can you please review?

@Simon128
Copy link

@Simon128 can you please review?

Will do, I've been quite busy with work the past weeks. I will take a look at this repo on the weekend

@Simon128
Copy link

@doubledare704 I'd suggest adding the advanced_filters test also to the sqlalchemy tests. I believe it works identically and you just have to copy & paste the parts from conftest.py and test_get_items.py into the corresponding files in the sqlalchemy test folder.

- Add filtered_client fixtures to SQLAlchemy conftest.py
- Add comprehensive test_read_items_with_advanced_filters to test_get_multi.py
  covering startswith filters
- Maintain parity with SQLModel test suite for consistent test coverage

Files changed:
- tests/sqlalchemy/conftest.py
- tests/sqlalchemy/crud/test_get_multi.py
@doubledare704
Copy link
Contributor Author

@Simon128, I've added conftest for sqlalchemy and test case to alchemy folder

@doubledare704 doubledare704 changed the title feat(tests): add filtered client fixture for testing endpoint filters Implerment advanced filter configs Mar 22, 2025
@doubledare704 doubledare704 changed the title Implerment advanced filter configs Implement advanced filter configs Mar 22, 2025
@igorbenav igorbenav self-requested a review March 24, 2025 02:15
Copy link
Collaborator

@igorbenav igorbenav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice!

@igorbenav igorbenav merged commit 92b4778 into benavlabs:main Mar 24, 2025
7 checks passed
@doubledare704 doubledare704 deleted the feature/implement-issue-196-Allowing-for-advanced-FilterConfigs branch April 23, 2025 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants