@@ -239,6 +239,33 @@ def test_add_without_user_root(self):
239239 user = self .app .store .get_user ('test6' )
240240 self .assertEqual ('' , user .user_root )
241241
242+ def test_add_with_username_too_long (self ):
243+ # Given a too long username
244+ username = "test2" * 52
245+ # When trying to create the user
246+ self ._add_user (username , None , "password" , "/tmp/" , USER_ROLE )
247+ # Then an error is raised
248+ self .assertStatus (200 )
249+ self .assertInBody ("Username too long." )
250+
251+ def test_add_with_email_too_long (self ):
252+ # Given a too long username
253+ email = ("test2" * 50 ) + "@test.com"
254+ # When trying to create the user
255+ self ._add_user ("test2" , email , "password" , "/tmp/" , USER_ROLE )
256+ # Then an error is raised
257+ self .assertStatus (200 )
258+ self .assertInBody ("Email too long." )
259+
260+ def test_add_with_user_root_too_long (self ):
261+ # Given a too long user root
262+ user_root = "/temp/" * 50
263+ # When trying to create the user
264+ self ._add_user ("test2" , "test@test,com" , "password" , user_root , USER_ROLE )
265+ # Then an error is raised
266+ self .assertStatus (200 )
267+ self .assertInBody ("Root directory too long." )
268+
242269 def test_delete_user_with_not_existing_username (self ):
243270 """
244271 Verify failure to delete invalid username.
0 commit comments