示例#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)
示例#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)
示例#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')
示例#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')
示例#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')
示例#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)
示例#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)
示例#8
0
 def test_not_discoverd(self, mock_get):
     self.task.driver.inspect = object()
     discoverd._check_status(self.task)
     self.assertFalse(mock_get.called)
示例#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)
示例#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')
示例#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)
示例#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)
示例#13
0
 def test_not_discoverd(self, mock_get):
     self.task.driver.inspect = object()
     discoverd._check_status(self.task)
     self.assertFalse(mock_get.called)
示例#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)