@@ -60,13 +60,13 @@ def test_index_view_docs_hidden(self):
6060 self .assertEqual (response .status_code , 404 )
6161 self .assertEqual (response .reason_phrase .upper (), "NOT FOUND" )
6262
63-  def  test_index_view_with_existent_app_name (self ):
63+  def  test_index_view_with_existent_namespace (self ):
6464 """ 
65-  Should load the drf docs view with all the endpoints contained in the specified app_name . 
65+  Should load the drf docs view with all the endpoints contained in the specified namespace . 
6666 NOTE: Views that do **not** inherit from DRF's "APIView" are not included. 
6767 """ 
68-  # Test 'accounts' app_name  
69-  response  =  self .client .get (reverse ('drfdocs-ns ' , args = ['accounts' ]))
68+  # Test 'accounts' namespace  
69+  response  =  self .client .get (reverse ('drfdocs-filter ' , args = ['accounts' ]))
7070 self .assertEqual (response .status_code , 200 )
7171 self .assertEqual (len (response .context ["endpoints" ]), 5 )
7272
@@ -75,26 +75,52 @@ def test_index_view_with_existent_app_name(self):
7575 self .assertEqual (response .context ["endpoints" ][0 ].allowed_methods , ['POST' , 'OPTIONS' ])
7676 self .assertEqual (response .context ["endpoints" ][0 ].path , "/accounts/login/" )
7777
78-  # Test 'organisations' app_name  
79-  response  =  self .client .get (reverse ('drfdocs-ns ' , args = ['organisations' ]))
78+  # Test 'organisations' namespace  
79+  response  =  self .client .get (reverse ('drfdocs-filter ' , args = ['organisations' ]))
8080 self .assertEqual (response .status_code , 200 )
81-  self .assertEqual (len (response .context ["endpoints" ]), 4 )
81+  self .assertEqual (len (response .context ["endpoints" ]), 3 )
8282
8383 # The view "OrganisationErroredView" (organisations/(?P<slug>[\w-]+)/errored/) should contain an error. 
84-  self .assertEqual (str (response .context ["endpoints" ][3 ].errors ), "'test_value'" )
84+  self .assertEqual (str (response .context ["endpoints" ][2 ].errors ), "'test_value'" )
8585
86-  def  test_index_search_with_existent_app_name (self ):
87-  response  =  self .client .get ("%s?search=reset-password"  %  reverse ('drfdocs-ns' , args = ['accounts' ]))
86+  # Test 'members' namespace 
87+  response  =  self .client .get (reverse ('drfdocs-filter' , args = ['members' ]))
88+  self .assertEqual (response .status_code , 200 )
89+  self .assertEqual (len (response .context ["endpoints" ]), 1 )
90+ 
91+  def  test_index_search_with_existent_namespace (self ):
92+  response  =  self .client .get ("%s?search=reset-password"  %  reverse ('drfdocs-filter' , args = ['accounts' ]))
8893
8994 self .assertEqual (response .status_code , 200 )
9095 self .assertEqual (len (response .context ["endpoints" ]), 2 )
9196 self .assertEqual (response .context ["endpoints" ][1 ].path , "/accounts/reset-password/confirm/" )
9297 self .assertEqual (len (response .context ["endpoints" ][1 ].fields ), 3 )
9398
94-  def  test_index_view_with_non_existent_app_name (self ):
99+  def  test_index_view_with_existent_app_name (self ):
100+  """ 
101+  Should load the drf docs view with all the endpoints contained in the specified app_name. 
102+  NOTE: Views that do **not** inherit from DRF's "APIView" are not included. 
103+  """ 
104+  # Test 'organisations_app' app_name 
105+  response  =  self .client .get (reverse ('drfdocs-filter' , args = ['organisations_app' ]))
106+  self .assertEqual (response .status_code , 200 )
107+  self .assertEqual (len (response .context ["endpoints" ]), 4 )
108+  parents_name  =  [e .name_parent  for  e  in  response .context ["endpoints" ]]
109+  self .assertEquals (parents_name .count ('organisations' ), 3 )
110+  self .assertEquals (parents_name .count ('members' ), 1 )
111+ 
112+  def  test_index_search_with_existent_app_name (self ):
113+  response  =  self .client .get ("%s?search=create"  %  reverse ('drfdocs-filter' , args = ['organisations_app' ]))
114+ 
115+  self .assertEqual (response .status_code , 200 )
116+  self .assertEqual (len (response .context ["endpoints" ]), 1 )
117+  self .assertEqual (response .context ["endpoints" ][0 ].path , "/organisations/create/" )
118+  self .assertEqual (len (response .context ["endpoints" ][0 ].fields ), 2 )
119+ 
120+  def  test_index_view_with_non_existent_namespace_or_app_name (self ):
95121 """ 
96122 Should load the drf docs view with no endpoint. 
97123 """ 
98-  response  =  self .client .get (reverse ('drfdocs-ns ' , args = ['non_existent_app_name ' ]))
124+  response  =  self .client .get (reverse ('drfdocs-filter ' , args = ['non_existent_ns_or_app_name ' ]))
99125 self .assertEqual (response .status_code , 200 )
100126 self .assertEqual (len (response .context ["endpoints" ]), 0 )
0 commit comments