Beispiel #1
0
    def test_iot_digitaltwin_property_update(self, fixture_cmd, serviceclient,
                                             payload_scenario):

        payload = None

        # If file path provided
        if not payload_scenario[0]:
            payload = payload_scenario[1]
        else:
            payload = str(
                read_file_content(
                    _device_digitaltwin_property_update_payload_file))

        subject.iot_digitaltwin_property_update(
            fixture_cmd,
            device_id=device_id,
            interface_payload=payload,
            login=mock_target["cs"],
        )
        args = serviceclient.call_args
        url = args[0][0].url
        method = args[0][0].method

        assert method == "PATCH"
        assert ("{}/digitalTwins/{}/interfaces?".format(
            mock_target["entity"], device_id) in url)
 def test_iot_digitaltwin_property_update_error(self, fixture_cmd,
                                                serviceclient_generic_error,
                                                payload_scenario):
     with pytest.raises(CLIError):
         subject.iot_digitaltwin_property_update(
             fixture_cmd,
             device_id=device_id,
             interface_payload=payload_scenario[0],
             login=mock_target['cs'])