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:
1212 self .mock_client = MagicMock ()
1313
1414 def test_run_job (self ) -> None :
15- # Setup
1615 job_id = "test-job-123"
1716 endpoint = "v2/test.endpoint"
1817 config = {"param1" : "value1" , "param2" : 42 }
1918
2019 self .mock_client .do_action_with_retry .return_value = iter ([ArrowTestResult ({"jobId" : job_id })])
2120
22- # Execute
2321 result = JobClient .run_job (self .mock_client , endpoint , config )
2422
25- # Verify
2623 expected_config = json .dumps (config ).encode ("utf-8" )
2724 self .mock_client .do_action_with_retry .assert_called_once_with (endpoint , expected_config )
2825 self .assertEqual (result , job_id )
You can’t perform that action at this time.
0 commit comments