volume_test.py 605 B

1234567891011121314151617181920212223
  1. import docker
  2. import pytest
  3. from compose import volume
  4. from tests import mock
  5. @pytest.fixture
  6. def mock_client():
  7. return mock.create_autospec(docker.APIClient)
  8. class TestVolume(object):
  9. def test_remove_local_volume(self, mock_client):
  10. vol = volume.Volume(mock_client, 'foo', 'project')
  11. vol.remove()
  12. mock_client.remove_volume.assert_called_once_with('foo_project')
  13. def test_remove_external_volume(self, mock_client):
  14. vol = volume.Volume(mock_client, 'foo', 'project', external=True)
  15. vol.remove()
  16. assert not mock_client.remove_volume.called