Skip to content

Commit

Permalink
Merge pull request #9732 from alphagov/content-modelling/chore/remove…
Browse files Browse the repository at this point in the history
…-deprecated-method

`get_content_by_embedded_document` is deprecated
  • Loading branch information
pezholio authored Dec 11, 2024
2 parents c2be210 + b993896 commit 98cd809
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def rollup

def content_items
@content_items ||= begin
response = Services.publishing_api.get_content_by_embedded_document(@content_id, { page:, order: }.compact)
response = Services.publishing_api.get_host_content_for_content_id(@content_id, { page:, order: }.compact)
response.parsed_content
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class ContentBlockManager::GetHostContentItemsTest < ActiveSupport::TestCase
let(:publishing_api_mock) { Minitest::Mock.new }

it "calls the Publishing API for the content which embeds the target" do
publishing_api_mock.expect :get_content_by_embedded_document, fake_api_response, [target_content_id, { order: ContentBlockManager::GetHostContentItems::DEFAULT_ORDER }]
publishing_api_mock.expect :get_host_content_for_content_id, fake_api_response, [target_content_id, { order: ContentBlockManager::GetHostContentItems::DEFAULT_ORDER }]

Services.stub :publishing_api, publishing_api_mock do
document = mock("content_block_document", content_id: target_content_id)
Expand All @@ -65,7 +65,7 @@ class ContentBlockManager::GetHostContentItemsTest < ActiveSupport::TestCase
end

it "supports pagination" do
publishing_api_mock.expect :get_content_by_embedded_document, fake_api_response, [target_content_id, { page: 1, order: ContentBlockManager::GetHostContentItems::DEFAULT_ORDER }]
publishing_api_mock.expect :get_host_content_for_content_id, fake_api_response, [target_content_id, { page: 1, order: ContentBlockManager::GetHostContentItems::DEFAULT_ORDER }]

Services.stub :publishing_api, publishing_api_mock do
document = mock("content_block_document", content_id: target_content_id)
Expand All @@ -80,7 +80,7 @@ class ContentBlockManager::GetHostContentItemsTest < ActiveSupport::TestCase
end

it "supports sorting" do
publishing_api_mock.expect :get_content_by_embedded_document, fake_api_response, [target_content_id, { order: "-abc" }]
publishing_api_mock.expect :get_host_content_for_content_id, fake_api_response, [target_content_id, { order: "-abc" }]

Services.stub :publishing_api, publishing_api_mock do
document = mock("content_block_document", content_id: target_content_id)
Expand Down Expand Up @@ -134,7 +134,7 @@ class ContentBlockManager::GetHostContentItemsTest < ActiveSupport::TestCase
)
raises_exception = ->(*_args) { raise exception }

Services.publishing_api.stub :get_content_by_embedded_document, raises_exception do
Services.publishing_api.stub :get_host_content_for_content_id, raises_exception do
document = mock("content_block_document", content_id: target_content_id)

assert_raises(GdsApi::HTTPErrorResponse) do
Expand Down

0 comments on commit 98cd809

Please sign in to comment.