File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -141,17 +141,25 @@ def test_provision_token_valid(self):
141141 """
142142 Test the provisioning of a new REST API token given a valid username and password.
143143 """
144- data = {
144+ user_credentials = {
145145 'username' : 'user1' ,
146146 'password' : 'abc123' ,
147147 }
148- user = User .objects .create_user (** data )
148+ user = User .objects .create_user (** user_credentials )
149+
150+ data = {
151+ ** user_credentials ,
152+ 'description' : 'My API token' ,
153+ 'expires' : '2099-12-31T23:59:59Z' ,
154+ }
149155 url = reverse ('users-api:token_provision' )
150156
151157 response = self .client .post (url , data , format = 'json' , ** self .header )
152158 self .assertEqual (response .status_code , 201 )
153159 self .assertIn ('key' , response .data )
154160 self .assertEqual (len (response .data ['key' ]), 40 )
161+ self .assertEqual (response .data ['description' ], data ['description' ])
162+ self .assertEqual (response .data ['expires' ], data ['expires' ])
155163 token = Token .objects .get (user = user )
156164 self .assertEqual (token .key , response .data ['key' ])
157165
You can’t perform that action at this time.
0 commit comments