File tree Expand file tree Collapse file tree 2 files changed +9
-11
lines changed
tests/time_tracker_api/activities
time_tracker_api/activities Expand file tree Collapse file tree 2 files changed +9
-11
lines changed Original file line number Diff line number Diff line change 16
16
)
17
17
def test_find_all_with_id_in_list (
18
18
find_partition_key_value_mock ,
19
- create_sql_condition_for_visibility_mock ,
20
19
event_context : EventContext ,
21
20
activity_repository : ActivityCosmosDBRepository ,
22
21
):
@@ -31,9 +30,10 @@ def test_find_all_with_id_in_list(
31
30
activity_repository .container = Mock ()
32
31
activity_repository .container .query_items = query_items_mock
33
32
34
- result = activity_repository .find_all_with_id_in_list (event_context , [expected_item ])
33
+ result = activity_repository .find_all_with_id_in_list (
34
+ event_context , [expected_item ]
35
+ )
35
36
36
- create_sql_condition_for_visibility_mock .assert_called_once ()
37
37
find_partition_key_value_mock .assert_called_once ()
38
38
query_items_mock .assert_called_once ()
39
39
Original file line number Diff line number Diff line change @@ -67,15 +67,13 @@ def find_all_with_id_in_list(
67
67
visible_only = True ,
68
68
mapper : Callable = None ,
69
69
):
70
- visibility = self .create_sql_condition_for_visibility (visible_only )
71
- query_str = """
72
- SELECT * FROM c
73
- WHERE {condition}
74
- {visibility_condition}
75
- """ .format (
76
- condition = create_sql_in_condition ("id" , activity_ids ),
77
- visibility_condition = visibility ,
70
+ query_builder = (
71
+ CosmosDBQueryBuilder ()
72
+ .add_sql_in_condition ('id' , activity_ids )
73
+ .add_sql_visibility_condition (visible_only )
74
+ .build ()
78
75
)
76
+ query_str = query_builder .get_query ()
79
77
80
78
tenant_id_value = self .find_partition_key_value (event_context )
81
79
result = self .container .query_items (
You can’t perform that action at this time.
0 commit comments