File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed
tests/unit/arrow_client/V2 Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change
1
+ import json
2
+
3
+ from graphdatascience .arrow_client .authenticated_flight_client import AuthenticatedArrowClient
4
+ from graphdatascience .arrow_client .v2 .api_types import MutateResult
5
+ from graphdatascience .arrow_client .v2 .data_mapper_utils import deserialize_single
6
+
7
+
8
+ class MutationClient :
9
+ MUTATE_ENDPOINT = "v2/results.mutate"
10
+
11
+ @staticmethod
12
+ def mutate_node_property (client : AuthenticatedArrowClient , job_id : str , mutate_property : str ) -> MutateResult :
13
+ mutate_config = {"jobId" : job_id , "mutateProperty" : mutate_property }
14
+ encoded_config = json .dumps (mutate_config ).encode ("utf-8" )
15
+ mutate_arrow_res = client .do_action_with_retry (MutationClient .MUTATE_ENDPOINT , encoded_config )
16
+ return MutateResult (** deserialize_single (mutate_arrow_res ))
Original file line number Diff line number Diff line change @@ -12,17 +12,14 @@ def setUp(self) -> None:
12
12
self .mock_client = MagicMock ()
13
13
14
14
def test_run_job (self ) -> None :
15
- # Setup
16
15
job_id = "test-job-123"
17
16
endpoint = "v2/test.endpoint"
18
17
config = {"param1" : "value1" , "param2" : 42 }
19
18
20
19
self .mock_client .do_action_with_retry .return_value = iter ([ArrowTestResult ({"jobId" : job_id })])
21
20
22
- # Execute
23
21
result = JobClient .run_job (self .mock_client , endpoint , config )
24
22
25
- # Verify
26
23
expected_config = json .dumps (config ).encode ("utf-8" )
27
24
self .mock_client .do_action_with_retry .assert_called_once_with (endpoint , expected_config )
28
25
self .assertEqual (result , job_id )
You can’t perform that action at this time.
0 commit comments