Example #1
0
 def test_create_volume(self, *args):
     '''
     test create volume.
     '''
     __salt__ = {
         'config.get': Mock(),
         'mine.send': Mock(),
     }
     client = Mock()
     client.api_version = '1.21'
     with patch.dict(dockerng_mod.__dict__, {'__salt__': __salt__}):
         with patch.dict(dockerng_mod.__context__,
                         {'docker.client': client}):
             dockerng_mod.create_volume(
                 'foo',
                 driver='bridge',
                 driver_opts={},
             )
     client.create_volume.assert_called_once_with(
         'foo',
         driver='bridge',
         driver_opts={},
     )
Example #2
0
 def test_create_volume(self, *args):
     '''
     test create volume.
     '''
     __salt__ = {
         'config.get': Mock(),
         'mine.send': Mock(),
     }
     client = Mock()
     client.api_version = '1.21'
     with patch.dict(dockerng_mod.__dict__,
                     {'__salt__': __salt__}):
         with patch.dict(dockerng_mod.__context__,
                         {'docker.client': client}):
             dockerng_mod.create_volume(
                 'foo',
                 driver='bridge',
                 driver_opts={},
             )
     client.create_volume.assert_called_once_with(
                 'foo',
                 driver='bridge',
                 driver_opts={},
     )
Example #3
0
    def test_create_volume(self, *args):
        '''
        test create volume.
        '''
        __salt__ = {
            'config.get': Mock(),
            'mine.send': Mock(),
        }
        client = Mock()
        client.api_version = '1.21'
        get_client_mock = MagicMock(return_value=client)

        with patch.dict(dockerng_mod.__dict__, {'__salt__': __salt__}):
            with patch.object(dockerng_mod, '_get_client', get_client_mock):
                dockerng_mod.create_volume(
                    'foo',
                    driver='bridge',
                    driver_opts={},
                )
        client.create_volume.assert_called_once_with(
            'foo',
            driver='bridge',
            driver_opts={},
        )