@@ -28,10 +28,10 @@ def test_index_view_with_endpoints(self):
2828 response = self .client .get (reverse ('drfdocs' ))
2929
3030 self .assertEqual (response .status_code , 200 )
31- self .assertEqual (len (response .context ["endpoints" ]), 15 )
31+ self .assertEqual (len (response .context ["endpoints" ]), 16 )
3232
3333 # Test the login view
34- endpoint = response .context ["endpoints" ][1 ]
34+ endpoint = response .context ["endpoints" ][4 ]
3535 self .assertEqual (endpoint .name_parent , "accounts" )
3636 self .assertEqual (endpoint .allowed_methods , ['POST' , 'OPTIONS' ])
3737 self .assertEqual (endpoint .path , "/accounts/login/" )
@@ -41,7 +41,7 @@ def test_index_view_with_endpoints(self):
4141 self .assertTrue (endpoint .fields [0 ]["required" ])
4242
4343 # The view "OrganisationErroredView" (organisations/(?P<slug>[\w-]+)/errored/) should contain an error.
44- endpoint = response .context ["endpoints" ][8 ]
44+ endpoint = response .context ["endpoints" ][12 ]
4545 self .assertEqual (str (endpoint .errors ), "'test_value'" )
4646
4747 def test_index_search_with_endpoints (self ):
@@ -81,10 +81,10 @@ def test_index_view_with_existent_namespace(self):
8181 # Test 'organisations' namespace
8282 response = self .client .get (reverse ('drfdocs-filter' , args = ['organisations' ]))
8383 self .assertEqual (response .status_code , 200 )
84- self .assertEqual (len (response .context ["endpoints" ]), 3 )
84+ self .assertEqual (len (response .context ["endpoints" ]), 5 )
8585
8686 # The view "OrganisationErroredView" (organisations/(?P<slug>[\w-]+)/errored/) should contain an error.
87- self .assertEqual (str (response .context ["endpoints" ][0 ].errors ), "'test_value'" )
87+ self .assertEqual (str (response .context ["endpoints" ][1 ].errors ), "'test_value'" )
8888
8989 # Test 'members' namespace
9090 response = self .client .get (reverse ('drfdocs-filter' , args = ['members' ]))
@@ -107,9 +107,9 @@ def test_index_view_with_existent_app_name(self):
107107 # Test 'organisations_app' app_name
108108 response = self .client .get (reverse ('drfdocs-filter' , args = ['organisations_app' ]))
109109 self .assertEqual (response .status_code , 200 )
110- self .assertEqual (len (response .context ["endpoints" ]), 4 )
110+ self .assertEqual (len (response .context ["endpoints" ]), 6 )
111111 parents_name = [e .name_parent for e in response .context ["endpoints" ]]
112- self .assertEquals (parents_name .count ('organisations' ), 3 )
112+ self .assertEquals (parents_name .count ('organisations' ), 5 )
113113 self .assertEquals (parents_name .count ('members' ), 1 )
114114
115115 def test_index_search_with_existent_app_name (self ):
@@ -118,7 +118,7 @@ def test_index_search_with_existent_app_name(self):
118118 self .assertEqual (response .status_code , 200 )
119119 self .assertEqual (len (response .context ["endpoints" ]), 1 )
120120 self .assertEqual (response .context ["endpoints" ][0 ].path , "/organisations/create/" )
121- self .assertEqual (len (response .context ["endpoints" ][0 ].fields ), 2 )
121+ self .assertEqual (len (response .context ["endpoints" ][0 ].fields ), 3 )
122122
123123 def test_index_view_with_non_existent_namespace_or_app_name (self ):
124124 """
@@ -130,14 +130,10 @@ def test_index_view_with_non_existent_namespace_or_app_name(self):
130130
131131 def test_model_viewset (self ):
132132 response = self .client .get (reverse ('drfdocs' ))
133-
134133 self .assertEqual (response .status_code , 200 )
135-
136- self .assertEqual (response .context ["endpoints" ][10 ].path , '/organisations/<slug>/' )
137- self .assertEqual (response .context ['endpoints' ][6 ].fields [2 ]['to_many_relation' ], True )
138- self .assertEqual (response .context ["endpoints" ][11 ].path , '/organisation-model-viewsets/' )
139- self .assertEqual (response .context ["endpoints" ][12 ].path , '/organisation-model-viewsets/<pk>/' )
140- self .assertEqual (response .context ["endpoints" ][11 ].allowed_methods , ['GET' , 'POST' , 'OPTIONS' ])
141- self .assertEqual (response .context ["endpoints" ][12 ].allowed_methods , ['GET' , 'PUT' , 'PATCH' , 'DELETE' , 'OPTIONS' ])
142- self .assertEqual (response .context ["endpoints" ][13 ].allowed_methods , ['POST' , 'OPTIONS' ])
143- self .assertEqual (response .context ["endpoints" ][13 ].docstring , 'This is a test.' )
134+ self .assertEqual (response .context ["endpoints" ][1 ].path , '/organisation-model-viewsets/' )
135+ self .assertEqual (response .context ["endpoints" ][2 ].path , '/organisation-model-viewsets/<pk>/' )
136+ self .assertEqual (response .context ["endpoints" ][1 ].allowed_methods , ['GET' , 'POST' , 'OPTIONS' ])
137+ self .assertEqual (response .context ["endpoints" ][2 ].allowed_methods , ['GET' , 'PUT' , 'PATCH' , 'DELETE' , 'OPTIONS' ])
138+ self .assertEqual (response .context ["endpoints" ][4 ].allowed_methods , ['POST' , 'OPTIONS' ])
139+ self .assertEqual (response .context ["endpoints" ][3 ].docstring , 'This is a test.' )
0 commit comments