def test_volume_absent(self): ''' Test dockerng.volume_absent ''' dockerng_remove_volume = Mock(return_value='removed') __salt__ = { 'dockerng.remove_volume': dockerng_remove_volume, 'dockerng.volumes': Mock(return_value={'Volumes': [{ 'Name': 'volume_foo' }]}), } with patch.dict(dockerng_state.__dict__, {'__salt__': __salt__}): ret = dockerng_state.volume_absent('volume_foo', ) dockerng_remove_volume.assert_called_with('volume_foo') self.assertEqual( ret, { 'name': 'volume_foo', 'comment': '', 'changes': { 'removed': 'removed' }, 'result': True })
def test_volume_absent(self): ''' Test dockerng.volume_absent ''' dockerng_remove_volume = Mock(return_value='removed') __salt__ = {'dockerng.remove_volume': dockerng_remove_volume, 'dockerng.volumes': Mock(return_value={ 'Volumes': [{'Name': 'volume_foo'}]}), } with patch.dict(dockerng_state.__dict__, {'__salt__': __salt__}): ret = dockerng_state.volume_absent( 'volume_foo', ) dockerng_remove_volume.assert_called_with('volume_foo') self.assertEqual(ret, {'name': 'volume_foo', 'comment': '', 'changes': {'removed': 'removed'}, 'result': True})