def test_input_parameter_error_with_multiple_targets(self): e = InputParameterError('exception details') e.setTargets(['some_func(a.b.c)', 'otherfunc(c.b.a)']) self.assertEqual( str(e), 'Invalid parameters (exception details); targets: "some_func(a.b.c), otherfunc(c.b.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\')"')