@@ -106,6 +106,17 @@ def test_start_page(self):
106106 self .assertTrue (b'Roundup' in f .content )
107107 self .assertTrue (b'Creator' in f .content )
108108
109+ def test_start_in_german (self ):
110+ """ simple test that verifies that the server can serve a start page
111+ and translate text to german. Use page title and remeber login
112+ checkbox label.
113+ """
114+ f = requests .get (self .url_base () + "?@language=de" )
115+ self .assertEqual (f .status_code , 200 )
116+ print (f .content )
117+ self .assertTrue (b'Roundup' in f .content )
118+ self .assertTrue (b'Aufgabenliste' in f .content )
119+ self .assertTrue (b'dauerhaft anmelden?' in f .content )
109120
110121 def test_rest_invalid_method_collection (self ):
111122 # use basic auth for rest endpoint
@@ -265,6 +276,42 @@ def test_rest_endpoint_attribute_options(self):
265276
266277 self .assertEqual (f .status_code , 404 )
267278
279+ def test_rest_login_rate_limit (self ):
280+ """login rate limit applies to api endpoints. Only failure
281+ logins count though. So log in 10 times in a row
282+ to verify that valid username/passwords aren't limited.
283+ """
284+
285+ for i in range (10 ):
286+ # use basic auth for rest endpoint
287+
288+ f = requests .options (self .url_base () + '/rest/data' ,
289+ auth = ('admin' , 'sekrit' ),
290+ headers = {'content-type' : "" }
291+ )
292+ print (f .status_code )
293+ print (f .headers )
294+
295+ self .assertEqual (f .status_code , 204 )
296+ expected = { 'Access-Control-Allow-Origin' : '*' ,
297+ 'Access-Control-Allow-Headers' : 'Content-Type, Authorization, X-Requested-With, X-HTTP-Method-Override' ,
298+ 'Allow' : 'OPTIONS, GET' ,
299+ 'Access-Control-Allow-Methods' : 'HEAD, OPTIONS, GET, POST, PUT, DELETE, PATCH' ,
300+ }
301+
302+ for i in range (10 ):
303+ # use basic auth for rest endpoint
304+
305+ f = requests .options (self .url_base () + '/rest/data' ,
306+ auth = ('admin' , 'ekrit' ),
307+ headers = {'content-type' : "" }
308+ )
309+ print (i , f .status_code )
310+ print (f .headers )
311+ print (f .text )
312+
313+ self .assertEqual (f .status_code , 401 )
314+
268315 def test_ims (self ):
269316 ''' retreive the user_utils.js file with old and new
270317 if-modified-since timestamps.
0 commit comments