Skip to content

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

Description

@PriyaT113

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'

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions