mirror of
				https://github.com/docker/compose.git
				synced 2025-10-31 19:24:21 +01:00 
			
		
		
		
	Closes: #6890 Some remarks, - `# coding ... utf-8` statements are not needed - isdigit on strings instead of a try-catch. - Default opening mode is read, so we can do `open()` without the `'r'` everywhere - Removed inheritinng from `object` class, it isn't necessary in python3. - `super(ClassName, self)` can now be replaced with `super()` - Use of itertools and `chain` on a couple places dealing with sets. - Used the operator module instead of lambdas when warranted `itemgetter(0)` instead of `lambda x: x[0]` `attrgetter('name')` instead of `lambda x: x.name` - `sorted` returns a list, so no need to use `list(sorted(...))` - Removed `dict()` using dictionary comprehensions whenever possible - Attempted to remove python3.2 support Signed-off-by: alexrecuenco <alejandrogonzalezrecuenco@gmail.com>
		
			
				
	
	
		
			24 lines
		
	
	
		
			597 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			24 lines
		
	
	
		
			597 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| import docker
 | |
| import pytest
 | |
| 
 | |
| from compose import volume
 | |
| from tests import mock
 | |
| 
 | |
| 
 | |
| @pytest.fixture
 | |
| def mock_client():
 | |
|     return mock.create_autospec(docker.APIClient)
 | |
| 
 | |
| 
 | |
| class TestVolume:
 | |
| 
 | |
|     def test_remove_local_volume(self, mock_client):
 | |
|         vol = volume.Volume(mock_client, 'foo', 'project')
 | |
|         vol.remove()
 | |
|         mock_client.remove_volume.assert_called_once_with('foo_project')
 | |
| 
 | |
|     def test_remove_external_volume(self, mock_client):
 | |
|         vol = volume.Volume(mock_client, 'foo', 'project', external=True)
 | |
|         vol.remove()
 | |
|         assert not mock_client.remove_volume.called
 |