From 3dc5cb1f37ee1707da8b3f42f39b1bd43b2e5f09 Mon Sep 17 00:00:00 2001 From: Andrew Cain Date: Wed, 20 Dec 2023 19:30:52 +1100 Subject: [PATCH] fix: ensure tests work and address tii check list items --- app/models/turn_it_in/tii_action.rb | 3 +++ app/models/turn_it_in/tii_action_upload_task_resources.rb | 5 +---- test/models/tii_group_attachment_test.rb | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/models/turn_it_in/tii_action.rb b/app/models/turn_it_in/tii_action.rb index b21c0135e..076ce6762 100644 --- a/app/models/turn_it_in/tii_action.rb +++ b/app/models/turn_it_in/tii_action.rb @@ -170,6 +170,9 @@ def handle_error(error, codes = []) when 403 self.error_code = :authentication_error return + when 451 + self.error_cde = :no_user_with_accepted_eula + return when 429 self.error_code = :rate_limited retry_request diff --git a/app/models/turn_it_in/tii_action_upload_task_resources.rb b/app/models/turn_it_in/tii_action_upload_task_resources.rb index 631c96308..0dec131a8 100644 --- a/app/models/turn_it_in/tii_action_upload_task_resources.rb +++ b/app/models/turn_it_in/tii_action_upload_task_resources.rb @@ -18,10 +18,7 @@ def update_from_attachment_status(response) save_and_mark_complete when 'ERROR' - self.error_code = :custom_tii_error - self.custom_error_message = response.error_code - Doubtfire::Application.config.logger.error "Error with tii submission: #{id} #{self.custom_error_message}" - save_and_log_custom_error + save_and_log_custom_error "Error with tii submission #{id} - #{response.error_code}" end end diff --git a/test/models/tii_group_attachment_test.rb b/test/models/tii_group_attachment_test.rb index ddf1d9aa8..598d4a51c 100644 --- a/test/models/tii_group_attachment_test.rb +++ b/test/models/tii_group_attachment_test.rb @@ -163,7 +163,7 @@ def test_group_attachment_process action.perform assert_requested get_status_stub, times: 3 - assert_equal 'TOO_LITTLE_TEXT', action.error_message + assert action.error_message.include?('TOO_LITTLE_TEXT') assert_equal :custom_tii_error, action.error_code.to_sym assert action.error?