def test_delete_request_no_request_id(self):
     """
     Tests no request_id given for deleting a job by request_id
     """
     try:
         mock_ssm_get_parameter(1)
         database.single_query = Mock(side_effect=
                                      [requests_db.BadRequestError(
                                          "No request_id provided")])
         requests_db.delete_request(None)
         self.fail("expected BadRequestError")
     except requests_db.BadRequestError as err:
         self.assertEqual("No request_id provided", str(err))
 def test_delete_request_database_error(self):
     """
     Tests database error while deleting a job by request_id
     """
     exp_err = 'Database Error. Internal database error, please contact LP DAAC User Services'
     try:
         mock_ssm_get_parameter(1)
         database.single_query = Mock(side_effect=[DbError(exp_err)])
         requests_db.delete_request('x')
         self.fail("expected DatabaseError")
     except requests_db.DatabaseError as err:
         self.assertEqual(exp_err, str(err))
         database.single_query.assert_called_once()
Example #3
0
 def test_delete_request(self):
     """
     Tests deleting a job by request_id
     """
     try:
         self.create_test_requests()
         boto3.client = Mock()
         mock_ssm_get_parameter(1)
         result = requests_db.delete_request(REQUEST_ID1)
         self.assertEqual([], result)
     except requests_db.DatabaseError as err:
         self.fail(f"delete_request. {str(err)}")
 def test_delete_request(self):
     """
     Tests deleting a job by request_id
     """
     try:
         exp_result = []
         mock_ssm_get_parameter(1)
         database.single_query = Mock(side_effect=[exp_result])
         result = requests_db.delete_request(REQUEST_ID1)
         self.assertEqual(exp_result, result)
         database.single_query.assert_called_once()
     except requests_db.DatabaseError as err:
         self.fail(f"delete_request. {str(err)}")