@@ -28,19 +28,27 @@ 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" ]), 10 )
31+ self .assertEqual (len (response .context ["endpoints" ]), 11 )
3232
3333 # Test the login view
34+ self .assertEqual (response .context ["endpoints" ][0 ].name_parent , "accounts" )
35+ self .assertEqual (response .context ["endpoints" ][0 ].allowed_methods , ['POST' , 'OPTIONS' ])
36+ self .assertEqual (response .context ["endpoints" ][0 ].path , "/accounts/login/" )
37+ self .assertEqual (response .context ["endpoints" ][0 ].docstring , "A view that allows users to login providing their username and password." )
38+ self .assertEqual (len (response .context ["endpoints" ][0 ].fields ), 2 )
39+ self .assertEqual (response .context ["endpoints" ][0 ].fields [0 ]["type" ], "CharField" )
40+ self .assertTrue (response .context ["endpoints" ][0 ].fields [0 ]["required" ])
41+
3442 self .assertEqual (response .context ["endpoints" ][1 ].name_parent , "accounts" )
35- self .assertEqual (response .context ["endpoints" ][1 ].allowed_methods , ['OPTIONS ' , 'POST ' ])
36- self .assertEqual (response .context ["endpoints" ][1 ].path , "/accounts/login /" )
37- self .assertEqual (response .context ["endpoints" ][1 ].docstring , "A view that allows users to login providing their username and password." )
43+ self .assertEqual (response .context ["endpoints" ][1 ].allowed_methods , ['POST ' , 'OPTIONS ' ])
44+ self .assertEqual (response .context ["endpoints" ][1 ].path , "/accounts/login2 /" )
45+ self .assertEqual (response .context ["endpoints" ][1 ].docstring , "A view that allows users to login providing their username and password. Without serializer_class " )
3846 self .assertEqual (len (response .context ["endpoints" ][1 ].fields ), 2 )
3947 self .assertEqual (response .context ["endpoints" ][1 ].fields [0 ]["type" ], "CharField" )
4048 self .assertTrue (response .context ["endpoints" ][1 ].fields [0 ]["required" ])
4149
4250 # The view "OrganisationErroredView" (organisations/(?P<slug>[\w-]+)/errored/) should contain an error.
43- self .assertEqual (str (response .context ["endpoints" ][7 ].errors ), "'test_value'" )
51+ self .assertEqual (str (response .context ["endpoints" ][9 ].errors ), "'test_value'" )
4452
4553 def test_index_search_with_endpoints (self ):
4654 response = self .client .get ("%s?search=reset-password" % reverse ("drfdocs" ))
0 commit comments