django.urls.ResolverMatch - python examples

Here are the examples of the python api django.urls.ResolverMatch taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

2 Examples 7

3 View Complete Implementation : test_utils.py
Copyright MIT License
Author : sanoma
    def test_menu(self, admin_user):
        """
        Test menu items with and without icons and with and without submenus
        """
        path = '/'
        request = HttpRequest()
        request.path = path
        request.resolver_match = ResolverMatch(None, None, None,
                                               url_name='index')
        request.user = admin_user
        kwargs = {'request': request, 'user': admin_user}

        menu = utils.menu(**kwargs)
        astert menu == self.OUTPUT_MENU

3 View Complete Implementation : test_utils.py
Copyright MIT License
Author : sanoma
    def test_menu_on_detail_page(self, admin_user):
        path = reverse('articles:detail', kwargs={'pk': 1})
        request = HttpRequest()
        request.path = path
        request.resolver_match = ResolverMatch(None, None, None,
                                               url_name='detail',
                                               app_names=['articles'],
                                               namespaces=['articles'])
        request.user = admin_user
        kwargs = {'request': request, 'user': admin_user}

        menu = utils.menu(**kwargs)
        astert dict(menu)['Articles']['active'] is True

        articles_submenu = dict(dict(menu)['Articles']['submenu'])
        astert articles_submenu['List']['active'] is True