Ejemplo n.º 1
0
 def test_status_error(self, mock_get):
     mock_get.return_value = {'error': 'boom'}
     discoverd._check_status(self.task)
     mock_get.assert_called_once_with(self.node.uuid,
                                      auth_token='the token')
     self.task.process_event.assert_called_once_with('fail')
     self.assertIn('boom', self.node.last_error)
Ejemplo n.º 2
0
 def test_status_error(self, mock_get):
     mock_get.return_value = {'error': 'boom'}
     discoverd._check_status(self.task)
     mock_get.assert_called_once_with(self.node.uuid,
                                      auth_token='the token')
     self.task.process_event.assert_called_once_with('fail')
     self.assertIn('boom', self.node.last_error)
Ejemplo n.º 3
0
 def test_service_url(self, mock_get):
     self.config(service_url='meow', group='discoverd')
     mock_get.return_value = {'finished': True}
     discoverd._check_status(self.task)
     mock_get.assert_called_once_with(self.node.uuid,
                                      auth_token='the token',
                                      base_url='meow')
     self.task.process_event.assert_called_once_with('done')
Ejemplo n.º 4
0
 def test_service_url(self, mock_get):
     self.config(service_url='meow', group='discoverd')
     mock_get.return_value = {'finished': True}
     discoverd._check_status(self.task)
     mock_get.assert_called_once_with(self.node.uuid,
                                      auth_token='the token',
                                      base_url='meow')
     self.task.process_event.assert_called_once_with('done')
Ejemplo n.º 5
0
 def test_status_ok(self, mock_get):
     mock_get.return_value = {'finished': True}
     discoverd._check_status(self.task)
     mock_get.assert_called_once_with(self.node.uuid,
                                      auth_token='the token')
     self.task.process_event.assert_called_once_with('done')
Ejemplo n.º 6
0
 def test_exception_ignored(self, mock_get):
     mock_get.side_effect = RuntimeError('boom')
     discoverd._check_status(self.task)
     mock_get.assert_called_once_with(self.node.uuid,
                                      auth_token='the token')
     self.assertFalse(self.task.process_event.called)
Ejemplo n.º 7
0
 def test_not_finished(self, mock_get):
     mock_get.return_value = {}
     discoverd._check_status(self.task)
     mock_get.assert_called_once_with(self.node.uuid,
                                      auth_token='the token')
     self.assertFalse(self.task.process_event.called)
Ejemplo n.º 8
0
 def test_not_discoverd(self, mock_get):
     self.task.driver.inspect = object()
     discoverd._check_status(self.task)
     self.assertFalse(mock_get.called)
Ejemplo n.º 9
0
 def test_not_inspecting(self, mock_get):
     self.node.provision_state = states.MANAGEABLE
     discoverd._check_status(self.task)
     self.assertFalse(mock_get.called)
Ejemplo n.º 10
0
 def test_status_ok(self, mock_get):
     mock_get.return_value = {'finished': True}
     discoverd._check_status(self.task)
     mock_get.assert_called_once_with(self.node.uuid,
                                      auth_token='the token')
     self.task.process_event.assert_called_once_with('done')
Ejemplo n.º 11
0
 def test_exception_ignored(self, mock_get):
     mock_get.side_effect = RuntimeError('boom')
     discoverd._check_status(self.task)
     mock_get.assert_called_once_with(self.node.uuid,
                                      auth_token='the token')
     self.assertFalse(self.task.process_event.called)
Ejemplo n.º 12
0
 def test_not_finished(self, mock_get):
     mock_get.return_value = {}
     discoverd._check_status(self.task)
     mock_get.assert_called_once_with(self.node.uuid,
                                      auth_token='the token')
     self.assertFalse(self.task.process_event.called)
Ejemplo n.º 13
0
 def test_not_discoverd(self, mock_get):
     self.task.driver.inspect = object()
     discoverd._check_status(self.task)
     self.assertFalse(mock_get.called)
Ejemplo n.º 14
0
 def test_not_inspecting(self, mock_get):
     self.node.provision_state = states.MANAGEABLE
     discoverd._check_status(self.task)
     self.assertFalse(mock_get.called)