Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'DockerVolume' object has no attribute 'volume' #8

Open
PriyaT113 opened this issue Apr 16, 2019 · 0 comments
Open

Comments

@PriyaT113
Copy link

class Value():
def create(self):
self.volume=do_func()
def remove(self):
self.volume.remove()

mock Test:
class TestValue(unittest.Testcase):
@mock.patch("docker.client.DockerClient","remove",new_callable=PropertyMock())
def test_remove(self,docker_remove):
vol_obj=Value()
vol_obj.remove()

Output:
testtools.testresult.real._StringException: Traceback (most recent call last):
File "/usr/lib/python3.6/unittest/mock.py", line 1179, in patched
return func(*args, **keywargs)
File "/tmp/tox_env/collie/tests/volumes/test_base.py", line 36, in test_remove
vol_obj.remove()
File "/tmp/tox_env/collie/volumes/base.py", line 25, in remove
self.volume.remove(force=True)
AttributeError: 'DockerVolume' object has no attribute 'volume'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant