def test_input_parameter_error_with_dashboard_id(self): e = InputParameterError('exception details') e.setSourceIdHeaders({'X-DASHBOARD-ID': 'abcde123'}) self.assertEqual( str(e), 'Invalid parameters (exception details); source: "X-DASHBOARD-ID: abcde123"', )
def test_input_parameter_error_with_panel_id(self): e = InputParameterError('exception details') e.setSourceIdHeaders({'X-PANEL-ID': 12}) self.assertEqual( str(e), 'Invalid parameters (exception details); source: "X-PANEL-ID: 12"', )
def test_input_parameter_error_with_grafana_org_id(self): e = InputParameterError('exception details') e.setSourceIdHeaders({'X-GRAFANA-ORG-ID': 3}) self.assertEqual( str(e), 'Invalid parameters (exception details); source: "X-GRAFANA-ORG-ID: 3"', )
def test_input_parameter_error_with_all_source_id(self): e = InputParameterError('exception details') e.setSourceIdHeaders({'X-GRAFANA-ORG-ID': 25, 'X-DASHBOARD-ID': 12}) e.setSourceIdHeaders({'X-PANEL-ID': 3}) self.assertEqual( str(e), 'Invalid parameters (exception details); source: "X-DASHBOARD-ID: 12, X-GRAFANA-ORG-ID: 25, X-PANEL-ID: 3"', )
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\')"')