def test_queue_image_not_forced_not_confirmed(self, mock_client, mock_confirm): # options.forced set to False and queue confirmation set to False. mock_confirm.return_value = False mock_options = mock.Mock() mock_options.force = False self.assertEqual(cache_manage.SUCCESS, cache_manage.queue_image(mock_options, ['img_id'])) self.assertFalse(mock_client.called)
def test_queue_image_not_forced_not_confirmed(self, mock_client, mock_confirm): # options.forced set to False and queue confirmation set to False. mock_confirm.return_value = False mock_options = mock.Mock() mock_options.force = False self.assertEqual(cache_manage.queue_image(mock_options, ['img_id']), cache_manage.SUCCESS) self.assertFalse(mock_client.called)
def test_queue_image_not_forced_confirmed(self, mock_client, mock_confirm): #options.forced set to False and queue confirmation set to True. mock_confirm.return_value = True mock_options = mock.Mock() mock_options.force = False mock_options.verbose = True # to cover additional condition and line manager = mock.MagicMock() manager.attach_mock(mock_client, 'mock_client') self.assertEqual(cache_manage.queue_image(mock_options, ['img_id']), cache_manage.SUCCESS) self.assertTrue(mock_client.called) self.assertTrue(mock.call.mock_client().queue_image_for_caching( 'img_id') in manager.mock_calls)
def test_queue_image_not_forced_confirmed(self, mock_client, mock_confirm): # options.forced set to False and queue confirmation set to True. mock_confirm.return_value = True mock_options = mock.Mock() mock_options.force = False mock_options.verbose = True # to cover additional condition and line manager = mock.MagicMock() manager.attach_mock(mock_client, 'mock_client') self.assertEqual(cache_manage.SUCCESS, cache_manage.queue_image(mock_options, ['img_id'])) self.assertTrue(mock_client.called) self.assertIn( mock.call.mock_client().queue_image_for_caching('img_id'), manager.mock_calls)
def test_queue_image_without_index(self): self.assertEqual(cache_manage.FAILURE, cache_manage.queue_image(mock.Mock(), []))
def test_queue_image_without_index(self): self.assertEqual(cache_manage.queue_image(mock.Mock(), []), cache_manage.FAILURE)