from djet import assertions, restframework
from rest_framework import status
import djoser.constants
import djoser.utils
import djoser.views


class RootViewTest(restframework.APIViewTestCase,
                   assertions.StatusCodeAssertionsMixin):
    view_class = djoser.views.RootView

    def test_get_should_return_urls_map(self):
        request = self.factory.get()
        view_object = self.create_view_object(request)
        response = view_object.dispatch(request)

        self.assert_status_equal(response, status.HTTP_200_OK)
        urlpattern_names = view_object.aggregate_djoser_urlpattern_names()
        urls_map = view_object.get_urls_map(request, urlpattern_names, None)
        self.assertEquals(urls_map, response.data)

    def test_all_urlpattern_names_are_in_urls_map(self):
        request = self.factory.get()
        view_object = self.create_view_object(request)
        response = view_object.dispatch(request)

        self.assert_status_equal(response, status.HTTP_200_OK)
        urlpattern_names = view_object.aggregate_djoser_urlpattern_names()
        for urlpattern_name in urlpattern_names:
            self.assertIn(urlpattern_name, response.data)

@@ -1168,24 +1168,381 @@
 rn_name, response.data)%0A
+%0A    def test_non_existent_urlpattern_results_in_empty_string(self):%0A        request = self.factory.get()%0A        view_object = self.create_view_object(request)%0A%0A        urlpattern_names = %5B'non-existent-urlpattern'%5D%0A        urls_map = view_object.get_urls_map(request, urlpattern_names, None)%0A        self.assertEquals(urls_map, %7Burlpattern_names%5B0%5D: ''%7D)%0A

Add test for non existent url pattern