Skip to content

Commit

Permalink
Remove legacy test about asset variant URL including original ID
Browse files Browse the repository at this point in the history
There are now no attachment types (other than images and their
variants) that result in anything other than the 'original' file
being uploaded to Asset Manager.

Whilst I could have changed this test to test a model that DOES
have variants (i.e. ImageData), with code something like what I've
put below, this behaviour is already covered by the "constructs
the url of the file using the assets root, media, asset_manager_id
and filename" test in this file, so I've deleted it instead.

```
    asset_path = "path/to/asset.png"
    model = ImageData.new
    model.id = 1
    model.assets << build(:asset, asset_manager_id: @asset_manager_id, variant: Asset.variants[:s216], filename: "asset_216.png")

    file = Whitehall::AssetManagerStorage::File.new(asset_path, model, "s216")

    assert_equal "http://assets-host/media/#{@asset_manager_id}/asset_216.png", file.url
```
  • Loading branch information
ChrisBAshton committed Dec 4, 2024
1 parent 502b427 commit 30900b5
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions test/unit/lib/whitehall/asset_manager_storage_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,6 @@ class Whitehall::AssetManagerStorage::FileTest < ActiveSupport::TestCase
assert_equal "http://assets-host/media/asset_manager_id/sample.docx", model.file.url
end

# TODO: commented out to get the tests passing.
# We should look at this again with fresh eyes - are we testing the right thing?
#
# test "returns file url using asset_manager_id when the model has an asset variant" do
# model = build(:attachment_data, attachable: build(:draft_edition, id: 1))
# model.save!
# model.reload

# assert_equal "http://assets-host/media/asset_manager_id_thumbnail/thumbnail_greenpaper.pdf.png", model.file.url(:thumbnail)
# end

# TODO: commented out to get the tests passing.
# We should better understand how to rewrite this test and whether it is still valuable.
#
Expand Down

0 comments on commit 30900b5

Please sign in to comment.