Exemplo n.º 1
0
 def test_ps_with_filters(self):
     '''
     Check that docker.ps accept filters parameter.
     '''
     client = MagicMock()
     with patch.dict(docker_mod.__context__, {'docker.client': client}):
         docker_mod.ps_(filters={'label': 'KEY'})
         client.containers.assert_called_once_with(all=True,
                                                   filters={'label': 'KEY'})
Exemplo n.º 2
0
 def test_ps_with_host_true(self):
     '''
     Check that docker.ps called with host is ``True``,
     include resutlt of ``network.interfaces`` command in returned result.
     '''
     network_interfaces = Mock(return_value={'mocked': None})
     with patch.dict(docker_mod.__salt__,
                     {'network.interfaces': network_interfaces}):
         with patch.dict(docker_mod.__context__,
                         {'docker.client': MagicMock()}):
             ret = docker_mod.ps_(host=True)
             self.assertEqual(ret,
                              {'host': {
                                  'interfaces': {
                                      'mocked': None
                                  }
                              }})