Skip to content
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

MAINT: Refactor to use factory pattern #146

Merged

Conversation

anish-mudaraddi
Copy link
Collaborator

change to now use a factory pattern to create queries
decouple query mappings and query components from queries

This will make chaining from one query to another easier

@anish-mudaraddi anish-mudaraddi force-pushed the openstack-query/factory-pattern branch from 927b674 to 31ac81e Compare October 3, 2023 14:41
This dataclass will be used to store query blocks
this is a better suited name since these classes only hold mapping info
fixup mapping interface
Remove QueryWrapper, use QueryFactory to create a QueryAPI object using QueryComponents Dataclass

Move QueryAPI to api sub-module
Add QueryBlocks as a way of accessing Query Objects in similar manner as before
refactor query_api tests, add tests for new classes
@anish-mudaraddi anish-mudaraddi force-pushed the openstack-query/factory-pattern branch from 31ac81e to 555782a Compare October 3, 2023 14:44
@codecov
Copy link

codecov bot commented Oct 3, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (724476b) 97.16% compared to head (51d3c68) 97.17%.
Report is 14 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #146      +/-   ##
==========================================
+ Coverage   97.16%   97.17%   +0.01%     
==========================================
  Files         134      142       +8     
  Lines        5925     6128     +203     
  Branches      404      410       +6     
==========================================
+ Hits         5757     5955     +198     
- Misses        138      144       +6     
+ Partials       30       29       -1     
Files Coverage Δ
lib/openstack_query/api/query_api.py 100.00% <100.00%> (ø)
lib/openstack_query/api/query_objects.py 100.00% <100.00%> (ø)
...ib/openstack_query/handlers/client_side_handler.py 100.00% <100.00%> (ø)
...ib/openstack_query/handlers/server_side_handler.py 100.00% <100.00%> (ø)
lib/openstack_query/managers/manager_wrapper.py 96.59% <100.00%> (ø)
lib/openstack_query/managers/server_manager.py 85.71% <100.00%> (ø)
lib/openstack_query/managers/user_manager.py 100.00% <100.00%> (ø)
lib/openstack_query/mappings/mapping_interface.py 100.00% <100.00%> (ø)
lib/openstack_query/mappings/server_mapping.py 100.00% <100.00%> (ø)
lib/openstack_query/mappings/user_mapping.py 100.00% <100.00%> (ø)
... and 11 more

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@anish-mudaraddi
Copy link
Collaborator Author

anish-mudaraddi commented Oct 4, 2023

Needs tests for Mappings

@anish-mudaraddi anish-mudaraddi force-pushed the openstack-query/factory-pattern branch 2 times, most recently from 142c9b6 to 9c64e43 Compare October 4, 2023 14:33
lib/openstack_query/api/query_objects.py Outdated Show resolved Hide resolved
lib/openstack_query/handlers/server_side_handler.py Outdated Show resolved Hide resolved
@anish-mudaraddi anish-mudaraddi force-pushed the openstack-query/factory-pattern branch 2 times, most recently from bc33ccc to 709bc95 Compare October 5, 2023 11:42
checks mappings are expected for each query mappings class
@anish-mudaraddi anish-mudaraddi force-pushed the openstack-query/factory-pattern branch from 709bc95 to 4cb8a20 Compare October 5, 2023 11:57
@anish-mudaraddi
Copy link
Collaborator Author

I've added client-side mapping tests - and altered server-side tests to ensure that there is an equivalent client-side test (to allow queries using from_subset)

@DavidFair DavidFair merged commit 11b30ab into stfc:main Oct 5, 2023
6 checks passed
@anish-mudaraddi anish-mudaraddi deleted the openstack-query/factory-pattern branch October 10, 2023 13:16
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.

2 participants