Skip to content

Commit

Permalink
return publishing app on HostContentItems
Browse files Browse the repository at this point in the history
Now that this PR is merged [1] we should be able to retrieve the name of
the publishing app for Host Content. We will shortly use this when
creating Publish Intents to remove the cache when updating Host Documents.

[1] alphagov/publishing-api#2876
  • Loading branch information
Harriethw committed Sep 20, 2024
1 parent e6bdcf3 commit 3111e62
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module ContentObjectStore
class HostContentItem < Data.define(:title, :base_path, :document_type, :publishing_organisation)
class HostContentItem < Data.define(:title, :base_path, :document_type, :publishing_organisation, :publishing_app)
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def items
base_path: item["base_path"],
document_type: item["document_type"],
publishing_organisation: item["primary_publishing_organisation"],
publishing_app: item["publishing_app"],
)
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class ContentObjectStore::ContentBlock::Document::Show::HostEditionsTableCompone
"title" => "Some title",
"base_path" => "/foo",
"document_type" => "document_type",
"publishing_app" => "publisher",
"publishing_organisation" => {
"content_id" => SecureRandom.uuid,
"title" => "bar",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class ContentObjectStore::GetHostContentItemsTest < ActiveSupport::TestCase
"title" => "foo",
"base_path" => "/foo",
"document_type" => "something",
"publishing_app" => "publisher",
"primary_publishing_organisation" => {
"content_id" => SecureRandom.uuid,
"title" => "bar",
Expand Down Expand Up @@ -63,6 +64,7 @@ class ContentObjectStore::GetHostContentItemsTest < ActiveSupport::TestCase
assert_equal result[0].title, response_body["results"][0]["title"]
assert_equal result[0].base_path, response_body["results"][0]["base_path"]
assert_equal result[0].document_type, response_body["results"][0]["document_type"]
assert_equal result[0].publishing_app, response_body["results"][0]["publishing_app"]
assert_equal result[0].publishing_organisation, expected_publishing_organisation
end

Expand Down

0 comments on commit 3111e62

Please sign in to comment.