-
Notifications
You must be signed in to change notification settings - Fork 960
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor Neo4jProxy table owners query for easier customization (#2182)
* refactor _exec_owners_query and get_table Signed-off-by: Ben Dye <[email protected]> * remove prior owners logic and references Signed-off-by: Ben Dye <[email protected]> * WIP Signed-off-by: Ben Dye <[email protected]> * update tests Signed-off-by: Ben Dye <[email protected]> * Add comment explaining testing-mock logic Signed-off-by: Ben Dye <[email protected]> * Cleanups Signed-off-by: Ben Dye <[email protected]> * Bump version Signed-off-by: Ben Dye <[email protected]> --------- Signed-off-by: Ben Dye <[email protected]>
- Loading branch information
Showing
3 changed files
with
40 additions
and
21 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -171,13 +171,6 @@ def setUp(self) -> None: | |
} | ||
], | ||
'last_updated_timestamp': 1, | ||
'owner_records': [ | ||
{ | ||
'key': '[email protected]', | ||
'email': '[email protected]', | ||
'updated_at': 0, | ||
} | ||
], | ||
'tag_records': [ | ||
{ | ||
'key': 'test', | ||
|
@@ -236,6 +229,14 @@ def setUp(self) -> None: | |
] | ||
}] | ||
|
||
owners_results = [{'owner_records': [ | ||
{ | ||
'key': '[email protected]', | ||
'email': '[email protected]', | ||
'updated_at': 0, | ||
} | ||
], }] | ||
|
||
last_updated_timestamp = '01' | ||
|
||
self.col_usage_return_value = [ | ||
|
@@ -250,6 +251,8 @@ def setUp(self) -> None: | |
|
||
self.table_common_usage = table_common_usage | ||
|
||
self.owners_return_value = owners_results | ||
|
||
self.col_bar_id_1_expected_type_metadata = self._get_col_bar_id_1_expected_type_metadata() | ||
self.col_bar_id_2_expected_type_metadata = self._get_col_bar_id_2_expected_type_metadata() | ||
|
||
|
@@ -355,9 +358,11 @@ def test_health_neo4j(self) -> None: | |
|
||
def test_get_table(self) -> None: | ||
with patch.object(GraphDatabase, 'driver'), patch.object(Neo4jProxy, '_execute_cypher_query') as mock_execute: | ||
# mock database return values such that we match ordering of queries executed in Neo4jProxy.get_table | ||
mock_execute.side_effect = [ | ||
self.col_usage_return_value, | ||
[], | ||
self.owners_return_value, | ||
self.table_level_return_value, | ||
self.table_common_usage, | ||
[] | ||
|
@@ -445,6 +450,7 @@ def test_get_table_view_only(self) -> None: | |
mock_execute.side_effect = [ | ||
col_usage_return_value, | ||
[], | ||
self.owners_return_value, | ||
self.table_level_return_value, | ||
self.table_common_usage, | ||
[] | ||
|