Ensure that verbs cannot be performed on disabled namespaces or by disabled users
This commit is contained in:
		
							parent
							
								
									db7e5f7cfa
								
							
						
					
					
						commit
						892cc82b6a
					
				
					 4 changed files with 47 additions and 0 deletions
				
			
		|  | @ -799,6 +799,40 @@ def test_pull_torrent(pusher, basic_images, liveserver_session, liveserver, | |||
|     assert expected == found | ||||
| 
 | ||||
| 
 | ||||
| def test_squashed_image_disabled_namespace(pusher, sized_images, liveserver_session, | ||||
|                                            liveserver, registry_server_executor, app_reloader): | ||||
|   """ Test: Attempting to pull a squashed image from a disabled namespace. """ | ||||
|   credentials = ('devtable', 'password') | ||||
| 
 | ||||
|   # Push an image to download. | ||||
|   pusher.push(liveserver_session, 'buynlarge', 'newrepo', 'latest', sized_images, | ||||
|               credentials=credentials) | ||||
| 
 | ||||
|   # Disable the buynlarge namespace. | ||||
|   registry_server_executor.on(liveserver).disable_namespace('buynlarge') | ||||
| 
 | ||||
|   # Attempt to pull the squashed version. | ||||
|   response = liveserver_session.get('/c1/squash/buynlarge/newrepo/latest', auth=credentials) | ||||
|   assert response.status_code == 400 | ||||
| 
 | ||||
| 
 | ||||
| def test_squashed_image_disabled_user(pusher, sized_images, liveserver_session, | ||||
|                                       liveserver, registry_server_executor, app_reloader): | ||||
|   """ Test: Attempting to pull a squashed image via a disabled user. """ | ||||
|   credentials = ('devtable', 'password') | ||||
| 
 | ||||
|   # Push an image to download. | ||||
|   pusher.push(liveserver_session, 'buynlarge', 'newrepo', 'latest', sized_images, | ||||
|               credentials=credentials) | ||||
| 
 | ||||
|   # Disable the devtable namespace. | ||||
|   registry_server_executor.on(liveserver).disable_namespace('devtable') | ||||
| 
 | ||||
|   # Attempt to pull the squashed version. | ||||
|   response = liveserver_session.get('/c1/squash/buynlarge/newrepo/latest', auth=credentials) | ||||
|   assert response.status_code == 403 | ||||
| 
 | ||||
| 
 | ||||
| @pytest.mark.parametrize('use_estimates', [ | ||||
|   False, | ||||
|   True, | ||||
|  |  | |||
		Reference in a new issue