@@ -26,16 +26,11 @@ def test_user_list(self):
2626 self .assertNotIn (item , user , r .content [:1000 ])
2727
2828 def test_user_add (self ):
29- # simple user without password
30- r = self .client .post (reverse ("user-list" ), {
31- "username" : "api-user-1" ,
32- }, format = "json" )
33- self .assertEqual (r .status_code , 201 , r .content [:1000 ])
34-
3529 # user with good password
3630 password = "testTEST1234!@#$"
3731 r = self .client .post (reverse ("user-list" ), {
3832 "username" : "api-user-2" ,
33+ "email" : "admin@dojo.com" ,
3934 "password" : password ,
4035 }, format = "json" )
4136 self .assertEqual (r .status_code , 201 , r .content [:1000 ])
@@ -50,6 +45,7 @@ def test_user_add(self):
5045 # user with weak password
5146 r = self .client .post (reverse ("user-list" ), {
5247 "username" : "api-user-3" ,
48+ "email" : "admin@dojo.com" ,
5349 "password" : "weakPassword" ,
5450 }, format = "json" )
5551 self .assertEqual (r .status_code , 400 , r .content [:1000 ])
@@ -59,30 +55,36 @@ def test_user_change_password(self):
5955 # some user
6056 r = self .client .post (reverse ("user-list" ), {
6157 "username" : "api-user-4" ,
58+ "email" : "admin@dojo.com" ,
59+ "password" : "testTEST1234!@#$" ,
6260 }, format = "json" )
6361 self .assertEqual (r .status_code , 201 , r .content [:1000 ])
6462 user_id = r .json ()["id" ]
6563
6664 r = self .client .put ("{}{}/" .format (reverse ("user-list" ), user_id ), {
6765 "username" : "api-user-4" ,
6866 "first_name" : "first" ,
67+ "email" : "admin@dojo.com" ,
6968 }, format = "json" )
7069 self .assertEqual (r .status_code , 200 , r .content [:1000 ])
7170
7271 r = self .client .patch ("{}{}/" .format (reverse ("user-list" ), user_id ), {
7372 "last_name" : "last" ,
73+ "email" : "admin@dojo.com" ,
7474 }, format = "json" )
7575 self .assertEqual (r .status_code , 200 , r .content [:1000 ])
7676
7777 r = self .client .put ("{}{}/" .format (reverse ("user-list" ), user_id ), {
7878 "username" : "api-user-4" ,
79+ "email" : "admin@dojo.com" ,
7980 "password" : "testTEST1234!@#$" ,
8081 }, format = "json" )
8182 self .assertEqual (r .status_code , 400 , r .content [:1000 ])
8283 self .assertIn ("Update of password though API is not allowed" , r .content .decode ("utf-8" ))
8384
8485 r = self .client .patch ("{}{}/" .format (reverse ("user-list" ), user_id ), {
8586 "password" : "testTEST1234!@#$" ,
87+ "email" : "admin@dojo.com" ,
8688 }, format = "json" )
8789 self .assertEqual (r .status_code , 400 , r .content [:1000 ])
8890 self .assertIn ("Update of password though API is not allowed" , r .content .decode ("utf-8" ))
0 commit comments