File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -187,6 +187,7 @@ def test_admin_can_create_config_on_other_apps(self):
187187 HTTP_AUTHORIZATION = 'token {}' .format (self .token ))
188188 self .assertEqual (response .status_code , 201 )
189189 self .assertIn ('PORT' , response .data ['values' ])
190+ return response
190191
191192 @mock .patch ('requests.post' , mock_import_repository_task )
192193 def test_limit_memory (self ):
@@ -423,3 +424,11 @@ def test_tags(self):
423424 self .assertEqual (response .status_code , 405 )
424425 response = self .client .delete (url , HTTP_AUTHORIZATION = 'token {}' .format (self .token ))
425426 self .assertEqual (response .status_code , 405 )
427+
428+ def test_config_owner_is_requesting_user (self ):
429+ """
430+ Ensure that setting the config value is owned by the requesting user
431+ See https://github.com/deis/deis/issues/2650
432+ """
433+ response = self .test_admin_can_create_config_on_other_apps ()
434+ self .assertEqual (response .data ['owner' ], self .user .username )
Original file line number Diff line number Diff line change @@ -289,7 +289,6 @@ def pre_save(self, config):
289289 previous_config = config .app .config_set .latest ()
290290 config .owner = self .request .user
291291 if previous_config :
292- config .owner = previous_config .owner
293292 for attr in ['cpu' , 'memory' , 'tags' , 'values' ]:
294293 # Guard against migrations from older apps without fixes to
295294 # JSONField encoding.
You can’t perform that action at this time.
0 commit comments