def test_get_component(self, get_component): fake_endpoint = 'endpoint' fake_credential = 'credential' fake_digital_twin_id = 'digital_twin_id' fake_component_path = 'component_path' digital_twin_client = DigitalTwinsClient(fake_endpoint, fake_credential) digital_twin_client.get_component(fake_digital_twin_id, fake_component_path) get_component.assert_called_with(fake_digital_twin_id, fake_component_path)
def test_get_component_with_kwargs(self, get_component): fake_endpoint = 'endpoint' fake_credential = 'credential' fake_digital_twin_id = 'digital_twin_id' fake_component_path = 'component_path' fake_kwargs = {'par1_key':'par1_val', 'par2_key':2} digital_twin_client = DigitalTwinsClient(fake_endpoint, fake_credential) digital_twin_client.get_component(fake_digital_twin_id, fake_component_path, **fake_kwargs) get_component.assert_called_with(fake_digital_twin_id, fake_component_path, **fake_kwargs)
# Create digital twin created_twin = service_client.upsert_digital_twin(digital_twin_id, temporary_twin) print('Created Digital Twin:') print(created_twin) # Update component component_path = "Component1" options = { "patchDocument": { "ComponentProp1": "value2" } } service_client.update_component(digital_twin_id, component_path, options) # Get component get_component = service_client.get_component(digital_twin_id, component_path) print('Get Component:') print(get_component) # Delete digital twin service_client.delete_digital_twin(digital_twin_id) # Decomission model service_client.decommission_model(model_id) # Delete model service_client.delete_model(model_id) except HttpResponseError as e: print("\nThis sample has caught an error. {0}".format(e.message))