Esempio n. 1
0
    def test_build_id_dict(self) -> None:
        templates = ["test_template1.html", "test_template2.html"]
        templates = [os.path.join(TEST_TEMPLATES_DIR, fn) for fn in templates]

        template_id_dict = build_id_dict(templates)

        self.assertEqual(set(template_id_dict.keys()),
                         {'below_navbar', 'hello_{{ message }}', 'intro'})
        self.assertEqual(template_id_dict['hello_{{ message }}'], [
            'Line 12:%s/tools/tests/test_template_data/test_template1.html' %
            (ZULIP_PATH, ),
            'Line 12:%s/tools/tests/test_template_data/test_template2.html' %
            (ZULIP_PATH, )
        ])
        self.assertEqual(template_id_dict['intro'], [
            'Line 10:%s/tools/tests/test_template_data/test_template1.html' %
            (ZULIP_PATH, ),
            'Line 11:%s/tools/tests/test_template_data/test_template1.html' %
            (ZULIP_PATH, ),
            'Line 11:%s/tools/tests/test_template_data/test_template2.html' %
            (ZULIP_PATH, )
        ])
        self.assertEqual(template_id_dict['below_navbar'], [
            'Line 10:%s/tools/tests/test_template_data/test_template2.html' %
            (ZULIP_PATH, )
        ])
Esempio n. 2
0
    def test_build_id_dict(self) -> None:
        templates = ["test_template1.html", "test_template2.html"]
        templates = [os.path.join(TEST_TEMPLATES_DIR, fn) for fn in templates]

        template_id_dict = build_id_dict(templates)

        self.assertEqual(set(template_id_dict.keys()),
                         {"below_navbar", "hello_{{ message }}", "intro"})
        self.assertEqual(
            template_id_dict["hello_{{ message }}"],
            [
                f"Line 12:{ZULIP_PATH}/tools/tests/test_template_data/test_template1.html",
                f"Line 12:{ZULIP_PATH}/tools/tests/test_template_data/test_template2.html",
            ],
        )
        self.assertEqual(
            template_id_dict["intro"],
            [
                f"Line 10:{ZULIP_PATH}/tools/tests/test_template_data/test_template1.html",
                f"Line 11:{ZULIP_PATH}/tools/tests/test_template_data/test_template1.html",
                f"Line 11:{ZULIP_PATH}/tools/tests/test_template_data/test_template2.html",
            ],
        )
        self.assertEqual(
            template_id_dict["below_navbar"],
            [
                f"Line 10:{ZULIP_PATH}/tools/tests/test_template_data/test_template2.html"
            ],
        )
Esempio n. 3
0
    def test_build_id_dict(self) -> None:
        templates = ["test_template1.html", "test_template2.html"]
        templates = [os.path.join(TEST_TEMPLATES_DIR, fn) for fn in templates]

        template_id_dict = build_id_dict(templates)

        self.assertEqual(set(template_id_dict.keys()), {'below_navbar', 'hello_{{ message }}', 'intro'})
        self.assertEqual(template_id_dict['hello_{{ message }}'], [
                         'Line 12:%s/tools/tests/test_template_data/test_template1.html' % (ZULIP_PATH),
                         'Line 12:%s/tools/tests/test_template_data/test_template2.html' % (ZULIP_PATH)])
        self.assertEqual(template_id_dict['intro'], [
                         'Line 10:%s/tools/tests/test_template_data/test_template1.html' % (ZULIP_PATH),
                         'Line 11:%s/tools/tests/test_template_data/test_template1.html' % (ZULIP_PATH),
                         'Line 11:%s/tools/tests/test_template_data/test_template2.html' % (ZULIP_PATH)])
        self.assertEqual(template_id_dict['below_navbar'], [
                         'Line 10:%s/tools/tests/test_template_data/test_template2.html' % (ZULIP_PATH)])