From 1de8001658ca80e7dc6cf1d05c1c806eec19f30c Mon Sep 17 00:00:00 2001 From: Alex Dolski Date: Thu, 18 Apr 2024 10:37:01 -0500 Subject: [PATCH] Unskip some ActiveJob tests --- test/controllers/imports_controller_test.rb | 15 +++------------ test/controllers/institutions_controller_test.rb | 6 +++--- test/controllers/users_controller_test.rb | 9 +++------ 3 files changed, 9 insertions(+), 21 deletions(-) diff --git a/test/controllers/imports_controller_test.rb b/test/controllers/imports_controller_test.rb index 2db5b6dd..c9d4fca8 100644 --- a/test/controllers/imports_controller_test.rb +++ b/test/controllers/imports_controller_test.rb @@ -34,19 +34,10 @@ class ImportsControllerTest < ActionDispatch::IntegrationTest end test "complete_upload() invokes an ImportJob" do - skip # TODO: why doesn't the job run? log_in_as(users(:southwest_admin)) - assert_difference "Item.count" do - package_root = File.join(file_fixture_path, "/packages/csv") - csv_package = File.join(Dir.tmpdir, "test.zip") - `cd "#{package_root}" && rm -f #{csv_package} && zip -r "#{csv_package}" valid_items` - @import.update!(filename: File.basename(csv_package), - length: File.size(csv_package)) - ObjectStore.instance.put_object(key: @import.file_key, - path: csv_package) - - post import_complete_upload_path(@import) - end + + post import_complete_upload_path(@import) + assert_equal 1, enqueued_jobs.select{ |j| j['job_class'] == "ImportJob" }.count end test "complete_upload() returns HTTP 204 upon success" do diff --git a/test/controllers/institutions_controller_test.rb b/test/controllers/institutions_controller_test.rb index 0f2cbf86..e7cfa0d2 100644 --- a/test/controllers/institutions_controller_test.rb +++ b/test/controllers/institutions_controller_test.rb @@ -690,13 +690,13 @@ class InstitutionsControllerTest < ActionDispatch::IntegrationTest end test "refresh_saml_config_metadata() updates an institution's SAML metadata" do - skip # TODO: why isn't the job executing in the test environment? user = users(:southwest_admin) log_in_as(user) institution = user.institution patch institution_refresh_saml_config_metadata_path(institution) - institution.reload - assert_not_nil institution.saml_idp_signing_cert + + assert_equal 1, enqueued_jobs. + select{ |j| j['job_class'] == "RefreshSamlConfigMetadataJob" }.count end test "refresh_saml_config_metadata() returns HTTP 302" do diff --git a/test/controllers/users_controller_test.rb b/test/controllers/users_controller_test.rb index d6c738a6..a0c79d66 100644 --- a/test/controllers/users_controller_test.rb +++ b/test/controllers/users_controller_test.rb @@ -619,15 +619,12 @@ class UsersControllerTest < ActionDispatch::IntegrationTest end test "update_submittable_collections() updates a user's submittable collections" do - skip # TODO: figure out why jobs aren't running in test user = users(:southwest) - collection = collections(:southwest_unit1_collection1) - collection.submitting_users << user - collection.save! log_in_as(user) patch user_update_submittable_collections_path(user), xhr: true - user.reload - assert_not_empty user.cached_submittable_collections + + assert_equal 2, enqueued_jobs. # 2 because 1 is also fired off at login + select{ |j| j['job_class'] == "CacheSubmittableCollectionsJob" }.count end test "update_submittable_collections() redirects to the created Task" do