def test_update_status_fail_raise(self, m_save):
     """ If raise_exception is True, an exception in the save() call should bubble up """
     result = None
     job = BulkJob()
     m_save.side_effect = Exception
     with self.assertRaises(Exception):
         result = job.update_status(BulkJob.STATUS_SETUP, raise_exception=True)
     self.assertTrue(m_save.called)
     self.assertIsNone(result)
 def test_update_status_fail_gracefully(self, m_save):
     """
     If raise_exception is not provided, or is False, an exception in the save() call should not bubble up,
      and the function should return False (indicating failure)
     """
     job = BulkJob()
     m_save.side_effect = Exception
     result = job.update_status(BulkJob.STATUS_SETUP)
     self.assertTrue(m_save.called)
     self.assertFalse(result)
 def test_update_status_fail_gracefully(self, m_save):
     """
     If raise_exception is not provided, or is False, an exception in the save() call should not bubble up,
      and the function should return False (indicating failure)
     """
     job = BulkJob()
     m_save.side_effect = Exception
     result = job.update_status(BulkJob.STATUS_SETUP)
     self.assertTrue(m_save.called)
     self.assertFalse(result)
 def test_update_status_fail_raise(self, m_save):
     """ If raise_exception is True, an exception in the save() call should bubble up """
     result = None
     job = BulkJob()
     m_save.side_effect = Exception
     with self.assertRaises(Exception):
         result = job.update_status(BulkJob.STATUS_SETUP,
                                    raise_exception=True)
     self.assertTrue(m_save.called)
     self.assertIsNone(result)
 def test_update_status_success(self, m_save):
     """ If no exception is raised in the save() call then the function should return True (indicating success) """
     job = BulkJob()
     result = job.update_status(BulkJob.STATUS_SETUP)
     self.assertTrue(m_save.called)
     self.assertTrue(result)
 def test_update_status_success(self, m_save):
     """ If no exception is raised in the save() call then the function should return True (indicating success) """
     job = BulkJob()
     result = job.update_status(BulkJob.STATUS_SETUP)
     self.assertTrue(m_save.called)
     self.assertTrue(result)