def test_input_parameter_error_with_func_args_kwargs(self): e = InputParameterError('exception details') e.setFunction('test_func', [3, 'd'], {'a': 1, 'b': 'b'}) self.assertEqual( str(e), 'Invalid parameters (exception details); func: "test_func(3, \'d\', a=1, b=\'b\')"', )
def test_input_parameter_error_with_func_and_args(self): e = InputParameterError('exception details') e.setFunction('test_func', [1, 'a'], {}) self.assertEqual( str(e), 'Invalid parameters (exception details); func: "test_func(1, \'a\')"', )
def test_input_parameter_error_with_all_properties(self): e = InputParameterError('exception details') e.setSourceIdHeaders({'X-DASHBOARD-ID': 'a'}) e.setSourceIdHeaders({'X-GRAFANA-ORG-ID': 'b'}) e.setSourceIdHeaders({'X-PANEL-ID': 'c'}) e.setTargets(['some(target, extra="value")']) e.setFunction('some', ['target'], {'extra': 'value'}) self.assertEqual( str(e), 'Invalid parameters (exception details)' '; targets: "some(target, extra="value")"' '; source: "X-DASHBOARD-ID: a, X-GRAFANA-ORG-ID: b, X-PANEL-ID: c"' '; func: "some(\'target\', extra=\'value\')"')