Beispiel #1
0
 def test__extend_results(self, mock_task_extend_results):
     mock_task_extend_results.side_effect = iter([["extended_foo"],
                                                  ["extended_bar"],
                                                  ["extended_spam"]])
     tasks_results = [{
         "key": "%s_key" % k,
         "sla": "%s_sla" % k,
         "full_duration": "%s_full_duration" % k,
         "load_duration": "%s_load_duration" % k,
         "result": "%s_result" % k
     } for k in ("foo", "bar", "spam")]
     generic_results = [{
         "id": None,
         "created_at": None,
         "updated_at": None,
         "task_uuid": None,
         "key": "%s_key" % k,
         "data": {
             "raw": "%s_result" % k,
             "full_duration": "%s_full_duration" % k,
             "load_duration": "%s_load_duration" % k,
             "sla": "%s_sla" % k
         }
     } for k in ("foo", "bar", "spam")]
     results = plot._extend_results(tasks_results)
     self.assertEqual([mock.call([r]) for r in generic_results],
                      mock_task_extend_results.mock_calls)
     self.assertEqual(["extended_foo", "extended_bar", "extended_spam"],
                      results)
Beispiel #2
0
 def test__extend_results(self, mock_task_extend_results):
     mock_task_extend_results.side_effect = iter(
         [["extended_foo"], ["extended_bar"], ["extended_spam"]])
     tasks_results = [
         {"key": "%s_key" % k, "sla": "%s_sla" % k,
          "full_duration": "%s_full_duration" % k,
          "load_duration": "%s_load_duration" % k,
          "result": "%s_result" % k} for k in ("foo", "bar", "spam")]
     generic_results = [
         {"id": None, "created_at": None, "updated_at": None,
          "task_uuid": None, "key": "%s_key" % k,
          "data": {"raw": "%s_result" % k,
                   "full_duration": "%s_full_duration" % k,
                   "load_duration": "%s_load_duration" % k,
                   "sla": "%s_sla" % k}} for k in ("foo", "bar", "spam")]
     results = plot._extend_results(tasks_results)
     self.assertEqual([mock.call([r]) for r in generic_results],
                      mock_task_extend_results.mock_calls)
     self.assertEqual(["extended_foo", "extended_bar", "extended_spam"],
                      results)
Beispiel #3
0
 def test__extend_results_empty(self):
     self.assertEqual([], plot._extend_results([]))
Beispiel #4
0
 def test__extend_results_empty(self):
     self.assertEqual([], plot._extend_results([]))