def test_sdc_resource_input_default_value(mock_send_message_json, mock_inputs): sdc_resource = SdcResource(name="test") sdc_resource.unique_identifier = "toto" mock_inputs.return_value = [ Input(unique_id="123", input_type="integer", name="test", sdc_resource=sdc_resource) ] assert sdc_resource.get_input("test") input_obj = sdc_resource.get_input("test") assert not input_obj.default_value input_obj.default_value = "123" mock_send_message_json.assert_called_once() assert input_obj.default_value == "123"
def test_get_input(mock_inputs): sdc_resource = SdcResource() mock_inputs.return_value = [ Input(unique_id="123", input_type="integer", name="test", sdc_resource=sdc_resource), Input(unique_id="321", input_type="string", name="test2", sdc_resource=sdc_resource) ] assert sdc_resource.get_input("test") assert sdc_resource.get_input("test2") with pytest.raises(AttributeError): sdc_resource.get_input("test3")