mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	help: Fix structure of markdown context logic.
Refactoring in this file had resulted in the logic for html_settings_link being duplicated and extra logic being needed to ensure these variables were set where they were needed. This fixes subscriptions_html not being rendered properly in the /help and /api pages, in addition to removing duplicate code.
This commit is contained in:
		@@ -153,10 +153,10 @@ class IntegrationTest(TestCase):
 | 
			
		||||
        self.assertEqual(context["api_url"], "http://mysubdomain.testserver/api")
 | 
			
		||||
        self.assertTrue(context["html_settings_links"])
 | 
			
		||||
 | 
			
		||||
    def test_integration_view_html_settings_links(self) -> None:
 | 
			
		||||
        context = dict()
 | 
			
		||||
        context['html_settings_links'] = False
 | 
			
		||||
        add_integrations_context(context)
 | 
			
		||||
    def test_html_settings_links(self) -> None:
 | 
			
		||||
        context = dict()  # type: Dict[str, Any]
 | 
			
		||||
        with self.settings(ROOT_DOMAIN_LANDING_PAGE=True):
 | 
			
		||||
            add_api_uri_context(context, HostRequestMock())
 | 
			
		||||
        self.assertEqual(
 | 
			
		||||
            context['settings_html'],
 | 
			
		||||
            'Zulip settings page')
 | 
			
		||||
@@ -165,8 +165,17 @@ class IntegrationTest(TestCase):
 | 
			
		||||
            'streams page')
 | 
			
		||||
 | 
			
		||||
        context = dict()
 | 
			
		||||
        context['html_settings_links'] = True
 | 
			
		||||
        add_integrations_context(context)
 | 
			
		||||
        with self.settings(ROOT_DOMAIN_LANDING_PAGE=True):
 | 
			
		||||
            add_api_uri_context(context, HostRequestMock(host="mysubdomain.testserver"))
 | 
			
		||||
        self.assertEqual(
 | 
			
		||||
            context['settings_html'],
 | 
			
		||||
            '<a href="../../#settings">Zulip settings page</a>')
 | 
			
		||||
        self.assertEqual(
 | 
			
		||||
            context['subscriptions_html'],
 | 
			
		||||
            '<a target="_blank" href="../../#streams">streams page</a>')
 | 
			
		||||
 | 
			
		||||
        context = dict()
 | 
			
		||||
        add_api_uri_context(context, HostRequestMock())
 | 
			
		||||
        self.assertEqual(
 | 
			
		||||
            context['settings_html'],
 | 
			
		||||
            '<a href="../../#settings">Zulip settings page</a>')
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user