Пример #1
0
 def test_container_state(self, ms):
     ms.return_value = ('200', fake_api.fake_container_state('RUNNING'))
     self.assertEqual(ms.return_value, self.lxd.container_state('trusty-1'))
     ms.assert_called_with('GET', '/1.0/containers/trusty-1/state')
Пример #2
0
 def test_container_config(self, ms):
     ms.return_value = ('200', fake_api.fake_container_state('fake'))
     self.assertEqual({'status': 'fake'},
                      self.lxd.get_container_config('trusty-1'))
     ms.assert_called_once_with('GET', '/1.0/containers/trusty-1?log=false')
Пример #3
0
 def test_container_info(self, ms):
     ms.return_value = ("200", fake_api.fake_container_state("fake"))
     self.assertEqual({"status": "fake"}, self.lxd.container_info("trusty-1"))
     ms.assert_called_once_with("GET", "/1.0/containers/trusty-1/state")
Пример #4
0
 def test_container_running(self, status, running, ms):
     with mock.patch.object(connection.LXDConnection, 'get_object') as ms:
         ms.return_value = ('200', fake_api.fake_container_state(status))
         self.assertEqual(running, self.lxd.container_running('trusty-1'))
         ms.assert_called_once_with('GET', '/1.0/containers/trusty-1/state')
Пример #5
0
 def test_container_state(self, ms):
     ms.return_value = ("200", fake_api.fake_container_state("RUNNING"))
     self.assertEqual("RUNNING", self.lxd.container_state("trusty-1"))
     ms.assert_called_with("GET", "/1.0/containers/trusty-1/state")
Пример #6
0
 def test_container_running(self, status, running, ms):
     with mock.patch.object(connection.LXDConnection, "get_object") as ms:
         ms.return_value = ("200", fake_api.fake_container_state(status))
         self.assertEqual(running, self.lxd.container_running("trusty-1"))
         ms.assert_called_once_with("GET", "/1.0/containers/trusty-1/state")
Пример #7
0
 def test_container_state(self, ms):
     ms.return_value = ('200', fake_api.fake_container_state('RUNNING'))
     self.assertEqual('RUNNING', self.lxd.container_state('trusty-1'))
     ms.assert_called_with('GET',
                           '/1.0/containers/trusty-1/state')
Пример #8
0
 def test_container_running(self, status, running, ms):
     with mock.patch.object(connection.LXDConnection, 'get_object') as ms:
         ms.return_value = ('200', fake_api.fake_container_state(status))
         self.assertEqual(running, self.lxd.container_running('trusty-1'))
         ms.assert_called_once_with('GET',
                                    '/1.0/containers/trusty-1/state')
Пример #9
0
 def test_container_info(self, ms):
     ms.return_value = ('200', fake_api.fake_container_state('fake'))
     self.assertEqual(
         {'status': 'fake'}, self.lxd.container_info('trusty-1'))
     ms.assert_called_once_with('GET',
                                '/1.0/containers/trusty-1/state')