Skip to content

Commit

Permalink
Remove ignored tests
Browse files Browse the repository at this point in the history
These tests were ignored after some asset migration features were removed and updated to raise an exception instead to catch legacy implementations. This means these tests are essentially out of date and useless. Deleting.
  • Loading branch information
minhngocd committed Jul 2, 2024
1 parent eb5e8f4 commit 147a72f
Showing 1 changed file with 0 additions and 119 deletions.
119 changes: 0 additions & 119 deletions spec/lib/whitehall_importer/migrate_assets_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,124 +24,5 @@
expect { described_class.call(whitehall_import) }
.to raise_error(NotImplementedError)
end

xit "logs individual errors and put asset into a migration failed state" do
whitehall_import = build(:whitehall_migration_document_import, assets: [asset])
allow(asset).to receive(:legacy_url_path).and_raise("Some error")
expect { described_class.call(whitehall_import) }
.to raise_error "Failed migrating at least one Whitehall asset"
expect(asset.state).to eq("migration_failed")
expect(asset.error_message).to include("Some error")
end

xit "attempts to migrate all assets and raise error only at the end" do
bad_asset = build(:whxitehall_migration_asset_import)
allow(bad_asset).to receive(:legacy_url_path).and_raise
whitehall_import = build(:whitehall_migration_document_import, assets: [bad_asset, asset])

expect { described_class.call(whitehall_import) }
.to raise_error "Failed migrating at least one Whitehall asset"
expect(bad_asset.state).to eq("migration_failed")
expect(asset.state).not_to eq("migration_failed")
end

xit "deletes draft assets" do
image_revision = build(:image_revision, :on_asset_manager, state: :draft)
asset = create(:whitehall_migration_asset_import,
image_revision:)
whitehall_import = build(:whitehall_migration_document_import, assets: [asset])
delete_asset_request = stub_asset_manager_delete_asset(asset_id)

described_class.call(whitehall_import)
expect(delete_asset_request).to have_been_requested
expect(asset.state).to eq("removed")
end

xit "deletes draft asset variants" do
image_revision = build(:image_revision, :on_asset_manager, state: :draft)
asset = create(:whitehall_migration_asset_import,
image_revision:,
variant: "s300")
delete_asset_request = stub_asset_manager_delete_asset(asset_id)
whitehall_import = build(:whitehall_migration_document_import, assets: [asset])

described_class.call(whitehall_import)
expect(delete_asset_request).to have_been_requested
expect(asset.state).to eq("removed")
end

xit "redirects live attachments to their content publisher equivalents" do
asset = build(:whitehall_migration_asset_import, :for_file_attachment)
whitehall_import = build(:whitehall_migration_document_import, assets: [asset])

stub_asset_manager_has_a_whitehall_asset(
asset.legacy_url_path, asset_manager_response
)
redirect_request = stub_asset_manager_update_asset(
asset_id,
redirect_url: asset.file_attachment_revision.asset_url,
)

described_class.call(whitehall_import)
expect(redirect_request).to have_been_requested
expect(asset.state).to eq("redirected")
end

xit "deletes attachment variants even if they are live" do
asset = create(:whitehall_migration_asset_import,
:for_file_attachment,
variant: "thumbnail")
whitehall_import = build(:whitehall_migration_document_import, assets: [asset])

stub_asset_manager_has_a_whitehall_asset(
asset.legacy_url_path, asset_manager_response
)
delete_request = stub_asset_manager_delete_asset(asset_id)

described_class.call(whitehall_import)
expect(delete_request).to have_been_requested
expect(asset.state).to eq("removed")
end

xit "redirects live images to their content publisher equivalents" do
asset = build(:whitehall_migration_asset_import,
:for_image)
whitehall_import = build(:whitehall_migration_document_import, assets: [asset])
redirect_request = stub_asset_manager_update_asset(
asset_id,
redirect_url: asset.image_revision.asset_url("960"),
)

described_class.call(whitehall_import)
expect(redirect_request).to have_been_requested
expect(asset.state).to eq("redirected")
end

xit "redirects live image variants to their content publisher equivalents" do
asset = build(:whitehall_migration_asset_import,
:for_image,
variant: "s300")
whitehall_import = build(:whitehall_migration_document_import, assets: [asset])
redirect_request = stub_asset_manager_update_asset(
asset_id,
redirect_url: asset.image_revision.asset_url("300"),
)

described_class.call(whitehall_import)
expect(redirect_request).to have_been_requested
expect(asset.state).to eq("redirected")
end

xit "deletes live image variants that have no content publisher equivalent" do
asset = build(:whitehall_migration_asset_import,
:for_image,
variant: "s216")
whitehall_import = build(:whitehall_migration_document_import, assets: [asset])
delete_request = stub_asset_manager_delete_asset(asset_id)

described_class.call(whitehall_import)
expect(delete_request).to have_been_requested
expect(asset.state).to eq("removed")
end
end
end

0 comments on commit 147a72f

Please sign in to comment.