Example #1
0
 def test_list_volumes(self, *args):
     '''
     test list volumes.
     '''
     __salt__ = {
         'config.get': Mock(),
         'mine.send': Mock(),
     }
     client = Mock()
     client.api_version = '1.21'
     with patch.dict(docker_mod.__dict__, {'__salt__': __salt__}):
         with patch.dict(docker_mod.__context__, {'docker.client': client}):
             docker_mod.volumes(filters={'dangling': [True]}, )
     client.volumes.assert_called_once_with(filters={'dangling': [True]}, )
Example #2
0
    def test_list_volumes(self, *args):
        '''
        test list volumes.
        '''
        __salt__ = {
            'config.get': Mock(),
            'mine.send': Mock(),
        }
        client = Mock()
        client.api_version = '1.21'
        get_client_mock = MagicMock(return_value=client)

        with patch.dict(docker_mod.__dict__, {'__salt__': __salt__}):
            with patch.object(docker_mod, '_get_client', get_client_mock):
                docker_mod.volumes(filters={'dangling': [True]}, )
        client.volumes.assert_called_once_with(filters={'dangling': [True]}, )
Example #3
0
def test_list_volumes():
    """
    test list volumes.
    """
    __salt__ = {
        "config.get": Mock(),
        "mine.send": Mock(),
    }
    client = Mock()
    client.api_version = "1.21"
    get_client_mock = MagicMock(return_value=client)

    with patch.dict(docker_mod.__dict__, {"__salt__": __salt__}):
        with patch.object(docker_mod, "_get_client", get_client_mock):
            docker_mod.volumes(filters={"dangling": [True]}, )
    client.volumes.assert_called_once_with(filters={"dangling": [True]}, )