Exemplo n.º 1
0
    def test_generate(self, mock_plot):
        tasks_results = get_tasks_results()
        tasks_results.extend(get_tasks_results())
        reporter = html.HTMLExporter(tasks_results, None)
        reporter._generate_results = mock.MagicMock()

        self.assertEqual({"print": "html"}, reporter.generate())

        reporter._generate_results.assert_called_once_with()
        mock_plot.assert_called_once_with(
            reporter._generate_results.return_value,
            include_libs=False)

        reporter = html.HTMLExporter(tasks_results, output_destination="path")
        self.assertEqual({"files": {"path": "html"},
                          "open": "file://" + os.path.abspath("path")},
                         reporter.generate())
Exemplo n.º 2
0
    def test__generate_results(self):
        tasks_results = [{
            "uuid":
            "task_id",
            "subtasks": [{
                "uuid":
                "subtask_id",
                "workloads": [
                    {
                        "uuid": "workload_id",
                        "name": "scenario_name",
                        "position": 0
                    },
                    {
                        "uuid": "workload_id",
                        "name": "scenario_name",
                        "position": 0
                    },
                ]
            }]
        }]

        reporter = html.HTMLExporter(tasks_results, None)

        self.assertEqual([{
            "uuid":
            "task_id",
            "subtasks": [{
                "uuid":
                "subtask_id",
                "workloads": [
                    {
                        "uuid": "workload_id",
                        "name": "scenario_name",
                        "position": 0
                    },
                    {
                        "uuid": "workload_id",
                        "name": "scenario_name",
                        "position": 1
                    },
                ]
            }]
        }], reporter._generate_results())