Пример #1
0
    def test_templates(self):
        # type: () -> None

        # Just add the templates whose context has a conflict with other
        # templates' context in `defer`.
        defer = ['analytics/activity.html']
        skip = defer + ['tests/test_markdown.html', 'zerver/terms.html']
        templates = [t for t in get_all_templates() if t not in skip]
        self.render_templates(templates, self.get_context())

        # Test the deferred templates with updated context.
        update = {'data': [('one', 'two')]}
        self.render_templates(defer, self.get_context(**update))
Пример #2
0
    def test_templates(self):
        # type: () -> None

        # Just add the templates whose context has a conflict with other
        # templates' context in `defer`.
        defer = ['analytics/activity.html']

        # Django doesn't send template_rendered signal for parent templates
        # https://code.djangoproject.com/ticket/24622
        covered = [
            'zerver/portico.html',
            'zerver/portico_signup.html',
        ]

        logged_out = [
            'confirmation/confirm.html',  # seems unused
            'zerver/compare.html',
            'zerver/footer.html',
        ]

        logged_in = [
            'analytics/stats.html',
            'zerver/drafts.html',
            'zerver/home.html',
            'zerver/invite_user.html',
            'zerver/keyboard_shortcuts.html',
            'zerver/left_sidebar.html',
            'zerver/landing_nav.html',
            'zerver/logout.html',
            'zerver/markdown_help.html',
            'zerver/navbar.html',
            'zerver/right_sidebar.html',
            'zerver/search_operators.html',
            'zerver/settings_overlay.html',
            'zerver/settings_sidebar.html',
            'zerver/stream_creation_prompt.html',
            'zerver/subscriptions.html',
            'zerver/message_history.html',
            'zerver/delete_message.html',
        ]
        unusual = [
            'zerver/emails/confirm_new_email.subject',
            'zerver/emails/compiled/confirm_new_email.html',
            'zerver/emails/confirm_new_email.txt',
            'zerver/emails/notify_change_in_email.subject',
            'zerver/emails/compiled/notify_change_in_email.html',
            'zerver/emails/digest.subject',
            'zerver/emails/digest.html',
            'zerver/emails/digest.txt',
            'zerver/emails/followup_day1.subject',
            'zerver/emails/compiled/followup_day1.html',
            'zerver/emails/followup_day1.txt',
            'zerver/emails/followup_day2.subject',
            'zerver/emails/followup_day2.txt',
            'zerver/emails/compiled/followup_day2.html',
            'zerver/emails/compiled/password_reset.html',
            'corporate/mit.html',
            'corporate/zephyr.html',
            'corporate/zephyr-mirror.html',
            'pipeline/css.jinja',
            'pipeline/inline_js.jinja',
            'pipeline/js.jinja',
            'zilencer/enterprise_tos_accept_body.txt',
            'zerver/zulipchat_migration_tos.html',
            'zilencer/enterprise_tos_accept_body.txt',
            'zerver/closed_realm.html',
            'zerver/topic_is_muted.html',
            'zerver/bankruptcy.html',
            'zerver/lightbox_overlay.html',
            'zerver/invalid_realm.html',
            'zerver/compose.html',
            'zerver/debug.html',
            'zerver/base.html',
            'zerver/api_content.json',
            'zerver/handlebars_compilation_failed.html',
            'zerver/portico-header.html',
        ]

        integrations_regexp = re.compile('zerver/integrations/.*.html')

        # Since static/generated/bots/ is searched by Jinja2 for templates,
        # it mistakes logo files under that directory for templates.
        bot_logos_regexp = re.compile('\w+\/logo\.(svg|png)$')

        skip = covered + defer + logged_out + logged_in + unusual + [
            'tests/test_markdown.html', 'zerver/terms.html',
            'zerver/privacy.html'
        ]

        templates = [
            t for t in get_all_templates()
            if not (t in skip or integrations_regexp.match(t)
                    or bot_logos_regexp.match(t))
        ]
        self.render_templates(templates, self.get_context())

        # Test the deferred templates with updated context.
        update = {'data': [('one', 'two')]}
        self.render_templates(defer, self.get_context(**update))
Пример #3
0
    def test_templates(self) -> None:

        # Just add the templates whose context has a conflict with other
        # templates' context in `defer`.
        defer = ['analytics/activity.html']

        # Django doesn't send template_rendered signal for parent templates
        # https://code.djangoproject.com/ticket/24622
        covered = [
            'zerver/portico.html',
            'zerver/portico_signup.html',
        ]

        logged_out = [
            'zerver/compare.html',
            'zerver/footer.html',
        ]

        logged_in = [
            'analytics/stats.html',
            'zerver/landing_nav.html',
        ]
        unusual = [
            'zerver/emails/confirm_new_email.subject.txt',
            'zerver/emails/compiled/confirm_new_email.html',
            'zerver/emails/confirm_new_email.txt',
            'zerver/emails/notify_change_in_email.subject.txt',
            'zerver/emails/compiled/notify_change_in_email.html',
            'zerver/emails/digest.subject.txt',
            'zerver/emails/digest.txt',
            'zerver/emails/followup_day1.subject.txt',
            'zerver/emails/compiled/followup_day1.html',
            'zerver/emails/followup_day1.txt',
            'zerver/emails/followup_day2.subject.txt',
            'zerver/emails/followup_day2.txt',
            'zerver/emails/compiled/followup_day2.html',
            'zerver/emails/compiled/password_reset.html',
            'corporate/zephyr.html',
            'corporate/zephyr-mirror.html',
            'zilencer/enterprise_tos_accept_body.txt',
            'zerver/zulipchat_migration_tos.html',
            'zilencer/enterprise_tos_accept_body.txt',
            'zerver/invalid_email.html',
            'zerver/invalid_realm.html',
            'zerver/debug.html',
            'zerver/base.html',
            'zerver/portico-header.html',
            'two_factor/_wizard_forms.html',
        ]

        integrations_regexp = re.compile(r'^zerver/integrations/.*\.html$')

        # Since static/generated/bots/ is searched by Jinja2 for templates,
        # it mistakes logo files under that directory for templates.
        bot_logos_regexp = re.compile(r'\w+\/logo\.(svg|png)$')

        skip = covered + defer + logged_out + logged_in + unusual + [
            'tests/test_markdown.html', 'zerver/terms.html',
            'zerver/privacy.html'
        ]

        all_templates = get_all_templates()
        self.assertEqual(set(skip) - set(all_templates), set())
        templates = [
            t for t in all_templates
            if not (t in skip or integrations_regexp.match(t)
                    or bot_logos_regexp.match(t))
        ]
        self.render_templates(templates, self.get_context())

        # Test the deferred templates with updated context.
        update = {'data': [('one', 'two')]}
        self.render_templates(defer, self.get_context(**update))
Пример #4
0
    def test_templates(self) -> None:

        # Just add the templates whose context has a conflict with other
        # templates' context in `defer`.
        defer = ['analytics/activity.html']

        # Django doesn't send template_rendered signal for parent templates
        # https://code.djangoproject.com/ticket/24622
        covered = [
            'zerver/portico.html',
            'zerver/portico_signup.html',
        ]

        logged_out = [
            'confirmation/confirm.html',  # seems unused
            'zerver/compare.html',
            'zerver/footer.html',
        ]

        logged_in = [
            'analytics/stats.html',
            'zerver/drafts.html',
            'zerver/home.html',
            'zerver/invite_user.html',
            'zerver/keyboard_shortcuts.html',
            'zerver/left_sidebar.html',
            'zerver/landing_nav.html',
            'zerver/logout.html',
            'zerver/markdown_help.html',
            'zerver/navbar.html',
            'zerver/right_sidebar.html',
            'zerver/search_operators.html',
            'zerver/settings_overlay.html',
            'zerver/settings_sidebar.html',
            'zerver/stream_creation_prompt.html',
            'zerver/subscriptions.html',
            'zerver/message_history.html',
            'zerver/delete_message.html',
        ]
        unusual = [
            'zerver/emails/confirm_new_email.subject',
            'zerver/emails/compiled/confirm_new_email.html',
            'zerver/emails/confirm_new_email.txt',
            'zerver/emails/notify_change_in_email.subject',
            'zerver/emails/compiled/notify_change_in_email.html',
            'zerver/emails/digest.subject',
            'zerver/emails/digest.html',
            'zerver/emails/digest.txt',
            'zerver/emails/followup_day1.subject',
            'zerver/emails/compiled/followup_day1.html',
            'zerver/emails/followup_day1.txt',
            'zerver/emails/followup_day2.subject',
            'zerver/emails/followup_day2.txt',
            'zerver/emails/compiled/followup_day2.html',
            'zerver/emails/compiled/password_reset.html',
            'corporate/mit.html',
            'corporate/zephyr.html',
            'corporate/zephyr-mirror.html',
            'pipeline/css.jinja',
            'pipeline/inline_js.jinja',
            'pipeline/js.jinja',
            'zilencer/enterprise_tos_accept_body.txt',
            'zerver/zulipchat_migration_tos.html',
            'zilencer/enterprise_tos_accept_body.txt',
            'zerver/invalid_email.html',
            'zerver/topic_is_muted.html',
            'zerver/bankruptcy.html',
            'zerver/lightbox_overlay.html',
            'zerver/invalid_realm.html',
            'zerver/compose.html',
            'zerver/debug.html',
            'zerver/base.html',
            'zerver/api_content.json',
            'zerver/handlebars_compilation_failed.html',
            'zerver/portico-header.html',
        ]

        integrations_regexp = re.compile('zerver/integrations/.*.html')

        # Since static/generated/bots/ is searched by Jinja2 for templates,
        # it mistakes logo files under that directory for templates.
        bot_logos_regexp = re.compile('\w+\/logo\.(svg|png)$')

        skip = covered + defer + logged_out + logged_in + unusual + ['tests/test_markdown.html',
                                                                     'zerver/terms.html',
                                                                     'zerver/privacy.html']

        templates = [t for t in get_all_templates() if not (
            t in skip or integrations_regexp.match(t) or bot_logos_regexp.match(t))]
        self.render_templates(templates, self.get_context())

        # Test the deferred templates with updated context.
        update = {'data': [('one', 'two')]}
        self.render_templates(defer, self.get_context(**update))