-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MAINT: Rework init for query objects
Reworks the Query objects to simplify the init chain. Just make copies where we need them instead of passing around multiple things in big chains. Further simplification will appear in a future commit to extract the factory out
- Loading branch information
Showing
9 changed files
with
107 additions
and
52 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from unittest.mock import patch | ||
|
||
from enums.query.props.server_properties import ServerProperties | ||
from openstack_query.queries.server_query import ServerQuery | ||
|
||
|
||
def test_server_query_enum_type(): | ||
""" | ||
Checks that server query returns the correct PropEnum type | ||
""" | ||
assert ServerQuery().prop_mapping == ServerProperties | ||
|
||
|
||
def test_server_query_runner_is_initialized(): | ||
""" | ||
Checks that server query runner is initialized | ||
with the correct prop_mapping | ||
""" | ||
with patch("openstack_query.queries.server_query.ServerRunner") as constructor: | ||
runner = ServerQuery().query_runner | ||
|
||
constructor.assert_called_with(ServerProperties) | ||
assert runner == constructor.return_value |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from unittest.mock import patch | ||
|
||
from enums.query.props.user_properties import UserProperties | ||
from openstack_query.queries.user_query import UserQuery | ||
|
||
|
||
def test_user_query_enum_type(): | ||
""" | ||
Checks that server query returns the correct PropEnum type | ||
""" | ||
assert UserQuery().prop_mapping == UserProperties | ||
|
||
|
||
def test_user_query_runner_is_initialized(): | ||
""" | ||
Checks that server query runner is initialized | ||
with the correct prop_mapping | ||
""" | ||
with patch("openstack_query.queries.user_query.UserRunner") as constructor: | ||
runner = UserQuery().query_runner | ||
|
||
constructor.assert_called_with(UserProperties) | ||
assert runner == constructor.return_value |
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