def test_main(self):
        results = [{
            "val2": 0.0111,
            "field": u"time",
            "val1": 0.0222,
            "type": "CHANGED",
            "test_name": u"test.one"
        }, {
            "val2": 0.111,
            "field": u"time",
            "val1": 0.222,
            "type": "CHANGED",
            "test_name": u"test.two"
        }, {
            "val2": 1.11,
            "field": u"time",
            "val1": 2.22,
            "type": "CHANGED",
            "test_name": u"test.three"
        }]

        fake_kw = {
            "heading": {
                "title": compare2html.__title__,
                "description": compare2html.__description__,
                "parameters": [("Difference Count", len(results))]
            },
            "generator": "compare2html %s" % compare2html.__version__,
            "results": results
        }

        with mock.patch("mako.template.Template") as mock_mako:
            compare2html.create_report(results)
            mock_mako().render.assert_called_once_with(**fake_kw)
Exemple #2
0
    def test_main(self, mock_get_template):
        results = [{"val2": 0.0111, "field": u"time", "val1": 0.0222,
                    "type": "CHANGED", "test_name": u"test.one"},
                   {"val2": 0.111, "field": u"time", "val1": 0.222,
                    "type": "CHANGED", "test_name": u"test.two"},
                   {"val2": 1.11, "field": u"time", "val1": 2.22,
                    "type": "CHANGED", "test_name": u"test.three"}]

        fake_template_kw = {
            "heading": {
                "title": compare2html.__title__,
                "description": compare2html.__description__,
                "parameters": [("Difference Count", len(results))]
            },
            "generator": "compare2html %s" % compare2html.__version__,
            "results": results
        }

        template_mock = mock.MagicMock()
        mock_get_template.return_value = template_mock
        output_mock = mock.MagicMock()
        template_mock.render.return_value = output_mock
        compare2html.create_report(results)

        mock_get_template.assert_called_once_with("verification/compare.mako")
        template_mock.render.assert_called_once_with(**fake_template_kw)
        output_mock.encode.assert_called_once_with("utf8")
Exemple #3
0
    def test_main(self):
        results = [{"val2": 0.0111, "field": u"time", "val1": 0.0222,
                    "type": "CHANGED", "test_name": u"test.one"},
                   {"val2": 0.111, "field": u"time", "val1": 0.222,
                    "type": "CHANGED", "test_name": u"test.two"},
                   {"val2": 1.11, "field": u"time", "val1": 2.22,
                    "type": "CHANGED", "test_name": u"test.three"}]

        fake_kw = {"heading":
                   {"title": compare2html.__title__,
                    "description": compare2html.__description__,
                    "parameters": [("Difference Count", len(results))]
                    },
                   "generator": "compare2html %s" % compare2html.__version__,
                   "results": results}

        with mock.patch("mako.template.Template") as mock_mako:
            compare2html.create_report(results)
            mock_mako().render.assert_called_once_with(**fake_kw)
Exemple #4
0
    def test_main(self, mock_get_template):
        results = [{
            "val2": 0.0111,
            "field": u"time",
            "val1": 0.0222,
            "type": "CHANGED",
            "test_name": u"test.one"
        }, {
            "val2": 0.111,
            "field": u"time",
            "val1": 0.222,
            "type": "CHANGED",
            "test_name": u"test.two"
        }, {
            "val2": 1.11,
            "field": u"time",
            "val1": 2.22,
            "type": "CHANGED",
            "test_name": u"test.three"
        }]

        fake_template_kw = {
            "heading": {
                "title": compare2html.__title__,
                "description": compare2html.__description__,
                "parameters": [("Difference Count", len(results))]
            },
            "generator": "compare2html %s" % compare2html.__version__,
            "results": results
        }

        template_mock = mock.MagicMock()
        mock_get_template.return_value = template_mock
        output_mock = mock.MagicMock()
        template_mock.render.return_value = output_mock
        compare2html.create_report(results)

        mock_get_template.assert_called_once_with("verification/compare.mako")
        template_mock.render.assert_called_once_with(**fake_template_kw)
        output_mock.encode.assert_called_once_with("utf8")
Exemple #5
0
 def to_html(self):
     return compare2html.create_report(self.diffs)
Exemple #6
0
 def to_html(self):
     return compare2html.create_report(self.diffs)