def test_metric_unit_color(expression, perf_string, check_command, result_color): metrics.fixup_unit_info() translated_metrics = metrics.translate_perf_data(perf_string, check_command) reference = { "color": result_color, "unit": translated_metrics.get(expression, {}).get('unit', {}).get('id', '') } assert gt.metric_unit_color(expression, translated_metrics, ['test']) == reference
def test_metric_unit_color(expression, perf_string, check_command, result_color): metrics.fixup_unit_info() translated_metrics = metrics.translate_perf_data(perf_string, check_command) translated_metric = translated_metrics.get(expression) assert translated_metric is not None unit = translated_metric.get("unit") assert unit is not None unit_id = unit.get("id") reference = { "color": result_color, "unit": unit_id, } assert gt.metric_unit_color(expression, translated_metrics, ["test"]) == reference
def test_metric_unit_color_exception(metric, perf_string, check_command): translated_metrics = metrics.translate_perf_data(perf_string, check_command) with pytest.raises(gt.MKGeneralException): gt.metric_unit_color(metric, translated_metrics, ['test'])
def test_metric_unit_color_skip(expression, perf_string, check_command): translated_metrics = metrics.translate_perf_data(perf_string, check_command) assert gt.metric_unit_color(expression, translated_metrics, ['test']) is None