def test_url_patterns(self):
        """
        Test to ensure that the url_patterns propery
        appropriately gets the django patterns object
        """
        d = DjangoDispatcher()
        self.assertIsInstance(d.url_patterns, list)
        self.assertEqual(len(d.url_patterns), 1)

        def fake():
            pass
        d.register_route('fake', endpoint_func=fake, route='route', methods=['GET'])
        route = DjangoDispatcher._convert_url_to_regex('route')
        self.assertIsInstance(d.url_patterns, list)
        regexes = [p._regex for p in d.url_patterns]
        self.assertEqual(len(regexes), 2)
        self.assertIn(route, regexes)
        self.assertIn('^$', regexes)
 def test_register_route(self):
     d = DjangoDispatcher(method_route_class=mock.MagicMock())
     d.register_route('fake', route='fake2')
     mr = d.url_map['^fake2$']
     self.assertIsInstance(mr, mock.MagicMock)
     self.assertEqual(mr.add_route.call_count, 2)