From 7764d86f5064c9439882eba500a4728120a5350c Mon Sep 17 00:00:00 2001 From: Jordan Brennan Date: Fri, 1 Nov 2019 16:23:43 +0000 Subject: [PATCH] Added the first test for the stat instance (#91) --- test/test_stats.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 test/test_stats.py diff --git a/test/test_stats.py b/test/test_stats.py new file mode 100644 index 00000000..eedbb7e8 --- /dev/null +++ b/test/test_stats.py @@ -0,0 +1,24 @@ +from mite.stats import labels_extractor + + +TXN_MSG = { + 'start_time': 1572604344.7903123, + 'end_time': 1572604346.0693598, + 'had_error': True, + 'type': 'txn', + 'time': 1572604346.0693617, + 'test': 'mite_project.file:scenario', + 'runner_id': 1, + 'journey': 'mite_project.file:journey', + 'context_id': 8, + 'scenario_id': 31, + 'scenario_data_id': 2, + 'transaction': 'txn_name', + 'transaction_id': 3} + + +def test_labels_extractor_txn_msg(): + extractor = labels_extractor("test journey transaction had_error".split()) + labels = extractor(TXN_MSG) + expected_value = ("mite_project.file:scenario", "mite_project.file:journey", "txn_name", True) + assert next(labels) == expected_value