From 7adfe0c3b5991b72f167ff89fb1739921f308175 Mon Sep 17 00:00:00 2001 From: iliyan Borisov Date: Tue, 16 Apr 2024 12:21:56 +0300 Subject: [PATCH] Fix/uppsf 5230 fix unrolling live blog packages in content unroller (#40) * Made article unroller default * Renamed Article and Internal Article unrollers to Default and Default internal * Added content package test --- content/clip_unroller_test.go | 4 +- content/clipset_unroller_test.go | 2 +- ...rticle_unroller.go => default_unroller.go} | 28 +-- ...oller_test.go => default_unroller_test.go} | 12 +- content/internal_article_unroller.go | 35 --- content/internal_default_unroller.go | 35 +++ ...t.go => internal_default_unroller_test.go} | 6 +- content/service.go | 13 +- content/service_test.go | 71 ++++++ ...content-liveblogpackage-valid-request.json | 190 +++++++++++++++ ...ontent-liveblogpackage-valid-response.json | 229 ++++++++++++++++++ ...lcontent-contentpackage-valid-request.json | 90 +++++++ ...content-contentpackage-valid-response.json | 150 ++++++++++++ ...ontent-liveblogpackage-valid-response.json | 50 ++++ ...content-contentpackage-valid-response.json | 62 +++++ 15 files changed, 908 insertions(+), 69 deletions(-) rename content/{article_unroller.go => default_unroller.go} (86%) rename content/{article_unroller_test.go => default_unroller_test.go} (97%) delete mode 100644 content/internal_article_unroller.go create mode 100644 content/internal_default_unroller.go rename content/{internal_article_unroller_test.go => internal_default_unroller_test.go} (98%) create mode 100644 content/testdata/content-liveblogpackage-valid-request.json create mode 100644 content/testdata/content-liveblogpackage-valid-response.json create mode 100644 content/testdata/internalcontent-contentpackage-valid-request.json create mode 100644 content/testdata/internalcontent-contentpackage-valid-response.json create mode 100644 content/testdata/reader-content-liveblogpackage-valid-response.json create mode 100644 content/testdata/reader-internalcontent-contentpackage-valid-response.json diff --git a/content/clip_unroller_test.go b/content/clip_unroller_test.go index 8e4e2b7..c0c03fa 100644 --- a/content/clip_unroller_test.go +++ b/content/clip_unroller_test.go @@ -35,7 +35,9 @@ func TestClipUnroller_Unroll(t *testing.T) { typeField: "wrong", }, }, - want: nil, + want: Content{ + typeField: "wrong", + }, wantErr: assert.Error, }, { diff --git a/content/clipset_unroller_test.go b/content/clipset_unroller_test.go index 0806bfa..ca8a476 100644 --- a/content/clipset_unroller_test.go +++ b/content/clipset_unroller_test.go @@ -63,7 +63,7 @@ func TestClipsetUnroller_Unroll(t *testing.T) { tid: testTID, uuid: testUUID, }, - want: nil, + want: invalidClipset, wantErr: assert.Error, }, { diff --git a/content/article_unroller.go b/content/default_unroller.go similarity index 86% rename from content/article_unroller.go rename to content/default_unroller.go index f6cad0e..fa6641e 100644 --- a/content/article_unroller.go +++ b/content/default_unroller.go @@ -7,22 +7,22 @@ import ( "github.com/Financial-Times/go-logger/v2" ) -type ArticleUnroller struct { +type DefaultUnroller struct { reader Reader log *logger.UPPLogger apiHost string } -func NewArticleUnroller(r Reader, log *logger.UPPLogger, apiHost string) *ArticleUnroller { - return &ArticleUnroller{ +func NewDefaultUnroller(r Reader, log *logger.UPPLogger, apiHost string) *DefaultUnroller { + return &DefaultUnroller{ reader: r, log: log, apiHost: apiHost, } } -func (u *ArticleUnroller) Unroll(req UnrollEvent) (Content, error) { - if !validateArticle(req.c) { +func (u *DefaultUnroller) Unroll(req UnrollEvent) (Content, error) { + if !validateDefaultContent(req.c) { return req.c, ErrValidating } @@ -64,7 +64,7 @@ func (u *ArticleUnroller) Unroll(req UnrollEvent) (Content, error) { return cc, nil } -func (u *ArticleUnroller) createContentSchema(cc Content, acceptedTypes []string, tid string, uuid string) Schema { +func (u *DefaultUnroller) createContentSchema(cc Content, acceptedTypes []string, tid string, uuid string) Schema { schema := make(Schema) localLog := u.log.WithUUID(uuid).WithTransactionID(tid) @@ -113,7 +113,7 @@ func (u *ArticleUnroller) createContentSchema(cc Content, acceptedTypes []string return schema } -func (u *ArticleUnroller) resolveModelsForSetsMembers(b Schema, imgMap map[string]Content, tid string, uuid string) { +func (u *DefaultUnroller) resolveModelsForSetsMembers(b Schema, imgMap map[string]Content, tid string, uuid string) { mainImageUUID := b.get(mainImageField) u.resolveImageSet(mainImageUUID, imgMap, tid, uuid) for _, embeddedImgSet := range b.getAll(embeds) { @@ -121,7 +121,7 @@ func (u *ArticleUnroller) resolveModelsForSetsMembers(b Schema, imgMap map[strin } } -func (u *ArticleUnroller) resolveImageSet(imageSetUUID string, imgMap map[string]Content, tid string, uuid string) { +func (u *DefaultUnroller) resolveImageSet(imageSetUUID string, imgMap map[string]Content, tid string, uuid string) { imageSet, found := resolveContent(imageSetUUID, imgMap) if !found { imgMap[imageSetUUID] = Content{id: createID(u.apiHost, "content", imageSetUUID)} @@ -166,7 +166,7 @@ func (u *ArticleUnroller) resolveImageSet(imageSetUUID string, imgMap map[string } } -func (u *ArticleUnroller) resolvePoster(poster interface{}, tid, uuid string) (Content, error) { +func (u *DefaultUnroller) resolvePoster(poster interface{}, tid, uuid string) (Content, error) { posterData, found := poster.(map[string]interface{}) if !found { return Content{}, errors.New("problem in poster field") @@ -184,10 +184,10 @@ func (u *ArticleUnroller) resolvePoster(poster interface{}, tid, uuid string) (C return posterContent[pUUID], nil } -func validateArticle(article Content) bool { - _, hasMainImage := article[mainImageField] - _, hasBody := article[bodyXMLField] - _, hasAltImg := article[altImagesField].(map[string]interface{}) +func validateDefaultContent(content Content) bool { + _, hasMainImage := content[mainImageField] + _, hasBody := content[bodyXMLField] + _, hasAltImg := content[altImagesField].(map[string]interface{}) - return (hasMainImage || hasBody || hasAltImg) && checkType(article, ArticleType) + return hasMainImage || hasBody || hasAltImg } diff --git a/content/article_unroller_test.go b/content/default_unroller_test.go similarity index 97% rename from content/article_unroller_test.go rename to content/default_unroller_test.go index 3488e48..3dcbc33 100644 --- a/content/article_unroller_test.go +++ b/content/default_unroller_test.go @@ -11,7 +11,7 @@ import ( ) func TestUnrollContent(t *testing.T) { - cu := ArticleUnroller{ + cu := DefaultUnroller{ reader: &ReaderMock{ mockGet: func(_ []string, _ string) (map[string]Content, error) { b, err := os.ReadFile("testdata/reader-content-valid-response.json") @@ -44,7 +44,7 @@ func TestUnrollContent(t *testing.T) { } func TestUnrollContent_NilSchema(t *testing.T) { - cu := ArticleUnroller{reader: nil} + cu := DefaultUnroller{reader: nil} var c Content err := json.Unmarshal([]byte(InvalidBodyRequest), &c) assert.NoError(t, err, "Cannot build json body") @@ -58,7 +58,7 @@ func TestUnrollContent_NilSchema(t *testing.T) { } func TestUnrollContent_ErrorExpandingFromContentStore(t *testing.T) { - cu := ArticleUnroller{ + cu := DefaultUnroller{ reader: &ReaderMock{ mockGet: func(_ []string, _ string) (map[string]Content, error) { return nil, errors.New("Cannot expand content from content store") @@ -89,7 +89,7 @@ func TestUnrollContent_SkipPromotionalImageWhenIdIsMissing(t *testing.T) { }, } - cu := ArticleUnroller{ + cu := DefaultUnroller{ reader: &ReaderMock{ mockGet: func(_ []string, _ string) (map[string]Content, error) { b, err := os.ReadFile("testdata/reader-content-valid-response.json") @@ -123,7 +123,7 @@ func TestUnrollContent_SkipPromotionalImageWhenUUIDIsInvalid(t *testing.T) { }, } - cu := ArticleUnroller{ + cu := DefaultUnroller{ reader: &ReaderMock{ mockGet: func(_ []string, _ string) (map[string]Content, error) { b, err := os.ReadFile("testdata/reader-content-valid-response.json") @@ -151,7 +151,7 @@ func TestUnrollContent_SkipPromotionalImageWhenUUIDIsInvalid(t *testing.T) { } func TestUnrollContent_EmbeddedContentSkippedWhenMissingBodyXML(t *testing.T) { - cu := ArticleUnroller{ + cu := DefaultUnroller{ reader: &ReaderMock{ mockGet: func(_ []string, _ string) (map[string]Content, error) { b, err := os.ReadFile("testdata/reader-content-valid-response-no-body.json") diff --git a/content/internal_article_unroller.go b/content/internal_article_unroller.go deleted file mode 100644 index 8e64b5f..0000000 --- a/content/internal_article_unroller.go +++ /dev/null @@ -1,35 +0,0 @@ -package content - -import "github.com/Financial-Times/go-logger/v2" - -type InternalArticleUnroller ArticleUnroller - -func NewInternalArticleUnroller(r Reader, log *logger.UPPLogger, apiHost string) *InternalArticleUnroller { - return (*InternalArticleUnroller)(NewArticleUnroller(r, log, apiHost)) -} - -func (u *InternalArticleUnroller) Unroll(req UnrollEvent) (Content, error) { - if !validateInternalArticle(req.c) { - return req.c, ErrValidating - } - - cc := req.c.clone() - expLeadImages, foundImages := unrollLeadImages(cc, u.reader, u.log, req.tid, req.uuid) - if foundImages { - cc[leadImages] = expLeadImages - } - - dynContents, foundDyn := unrollDynamicContent(cc, u.log, req.tid, req.uuid, u.reader.GetInternal) - if foundDyn { - cc[embeds] = dynContents - } - - return cc, nil -} - -func validateInternalArticle(article Content) bool { - _, hasLeadImages := article[leadImages] - _, hasBody := article[bodyXMLField] - - return (hasLeadImages || hasBody) && checkType(article, ArticleType) -} diff --git a/content/internal_default_unroller.go b/content/internal_default_unroller.go new file mode 100644 index 0000000..0af0058 --- /dev/null +++ b/content/internal_default_unroller.go @@ -0,0 +1,35 @@ +package content + +import "github.com/Financial-Times/go-logger/v2" + +type DefaultInternalUnroller DefaultUnroller + +func NewDefaultInternalUnroller(r Reader, log *logger.UPPLogger, apiHost string) *DefaultInternalUnroller { + return (*DefaultInternalUnroller)(NewDefaultUnroller(r, log, apiHost)) +} + +func (u *DefaultInternalUnroller) Unroll(req UnrollEvent) (Content, error) { + if !validateInternalDefaultContent(req.c) { + return req.c, ErrValidating + } + + cc := req.c.clone() + expLeadImages, foundImages := unrollLeadImages(cc, u.reader, u.log, req.tid, req.uuid) + if foundImages { + cc[leadImages] = expLeadImages + } + + dynContents, foundDyn := unrollDynamicContent(cc, u.log, req.tid, req.uuid, u.reader.GetInternal) + if foundDyn { + cc[embeds] = dynContents + } + + return cc, nil +} + +func validateInternalDefaultContent(content Content) bool { + _, hasLeadImages := content[leadImages] + _, hasBody := content[bodyXMLField] + + return hasLeadImages || hasBody +} diff --git a/content/internal_article_unroller_test.go b/content/internal_default_unroller_test.go similarity index 98% rename from content/internal_article_unroller_test.go rename to content/internal_default_unroller_test.go index cab381b..dbb4d36 100644 --- a/content/internal_article_unroller_test.go +++ b/content/internal_default_unroller_test.go @@ -11,7 +11,7 @@ import ( ) func TestUnrollInternalContent(t *testing.T) { - cu := InternalArticleUnroller{ + cu := DefaultInternalUnroller{ reader: &ReaderMock{ mockGet: func(_ []string, _ string) (map[string]Content, error) { b, err := os.ReadFile("testdata/reader-internalcontent-valid-response.json") @@ -53,7 +53,7 @@ func TestUnrollInternalContent(t *testing.T) { } func TestUnrollInternalContent_LeadImagesSkippedWhenReadingError(t *testing.T) { - cu := InternalArticleUnroller{ + cu := DefaultInternalUnroller{ reader: &ReaderMock{ mockGet: func(_ []string, _ string) (map[string]Content, error) { return nil, errors.New("Error retrieving content") @@ -90,7 +90,7 @@ func TestUnrollInternalContent_LeadImagesSkippedWhenReadingError(t *testing.T) { } func TestUnrollInternalContent_DynamicContentSkippedWhenReadingError(t *testing.T) { - cu := InternalArticleUnroller{ + cu := DefaultInternalUnroller{ reader: &ReaderMock{ mockGet: func(_ []string, _ string) (map[string]Content, error) { b, err := os.ReadFile("testdata/reader-internalcontent-valid-response.json") diff --git a/content/service.go b/content/service.go index 594bfe6..543dd50 100644 --- a/content/service.go +++ b/content/service.go @@ -2,7 +2,6 @@ package content import ( "errors" - "fmt" "slices" "github.com/Financial-Times/go-logger/v2" @@ -50,11 +49,9 @@ func NewUniversalUnroller(r Reader, log *logger.UPPLogger, apiHost string) *Univ } func (u *UniversalUnroller) UnrollContent(event UnrollEvent) (Content, error) { - articleUnroller := NewArticleUnroller(u.reader, u.log, u.apiHost) + defaultUnroller := NewDefaultUnroller(u.reader, u.log, u.apiHost) switch getEventType(event.c) { - case ArticleType: - return articleUnroller.Unroll(event) case ClipSetType: return u.unrollClipSet(event) case ClipType: @@ -62,18 +59,16 @@ func (u *UniversalUnroller) UnrollContent(event UnrollEvent) (Content, error) { case ImageSetType: return u.unrollImageSet(event) default: - return nil, errors.Join(ErrValidating, fmt.Errorf("unsupported content type %s", getEventType(event.c))) + return defaultUnroller.Unroll(event) } } func (u *UniversalUnroller) UnrollInternalContent(event UnrollEvent) (Content, error) { - articleUnroller := NewInternalArticleUnroller(u.reader, u.log, u.apiHost) + defaultInternalUnroller := NewDefaultInternalUnroller(u.reader, u.log, u.apiHost) switch getEventType(event.c) { - case ArticleType: - return articleUnroller.Unroll(event) default: - return nil, errors.Join(ErrValidating, fmt.Errorf("unsupported content type %s", getEventType(event.c))) + return defaultInternalUnroller.Unroll(event) } } diff --git a/content/service_test.go b/content/service_test.go index 20ed504..654ea82 100644 --- a/content/service_test.go +++ b/content/service_test.go @@ -5,6 +5,7 @@ import ( "os" "testing" + "github.com/Financial-Times/go-logger/v2" "github.com/stretchr/testify/assert" ) @@ -164,3 +165,73 @@ func Test_getEventType(t *testing.T) { }) } } + +func TestUnrollContent_LiveBlogPackage(t *testing.T) { + testReader := &ReaderMock{ + mockGet: func(_ []string, _ string) (map[string]Content, error) { + b, err := os.ReadFile("testdata/reader-content-liveblogpackage-valid-response.json") + assert.NoError(t, err, "Cannot open file necessary for test case") + var res map[string]Content + err = json.Unmarshal(b, &res) + assert.NoError(t, err, "Cannot return valid response") + return res, nil + }, + } + defaultAPIHost := "test.api.ft.com" + unroller := UniversalUnroller{ + reader: testReader, + log: logger.NewUPPLogger("test", "debug"), + apiHost: defaultAPIHost, + } + + expected, err := os.ReadFile("testdata/content-liveblogpackage-valid-response.json") + assert.NoError(t, err, "Cannot read necessary test file") + + var c Content + fileBytes, err := os.ReadFile("testdata/content-liveblogpackage-valid-request.json") + assert.NoError(t, err, "Cannot read necessary test file") + err = json.Unmarshal(fileBytes, &c) + assert.NoError(t, err, "Cannot build json body") + req := UnrollEvent{c, "tid_sample", "sample_uuid"} + actual, err := unroller.UnrollContent(req) + assert.NoError(t, err, "Should not get an error when expanding clipset") + + actualJSON, err := json.Marshal(actual) + assert.NoError(t, err, "Expected to marshall correctly") + assert.JSONEq(t, string(expected), string(actualJSON)) +} + +func TestUnrollContent_ContentPackage(t *testing.T) { + testReader := &ReaderMock{ + mockGet: func(_ []string, _ string) (map[string]Content, error) { + b, err := os.ReadFile("testdata/reader-internalcontent-contentpackage-valid-response.json") + assert.NoError(t, err, "Cannot open file necessary for test case") + var res map[string]Content + err = json.Unmarshal(b, &res) + assert.NoError(t, err, "Cannot return valid response") + return res, nil + }, + } + defaultAPIHost := "test.api.ft.com" + unroller := UniversalUnroller{ + reader: testReader, + log: logger.NewUPPLogger("test", "debug"), + apiHost: defaultAPIHost, + } + + expected, err := os.ReadFile("testdata/internalcontent-contentpackage-valid-response.json") + assert.NoError(t, err, "Cannot read necessary test file") + + var c Content + fileBytes, err := os.ReadFile("testdata/internalcontent-contentpackage-valid-request.json") + assert.NoError(t, err, "Cannot read necessary test file") + err = json.Unmarshal(fileBytes, &c) + assert.NoError(t, err, "Cannot build json body") + req := UnrollEvent{c, "tid_sample", "sample_uuid"} + actual, err := unroller.UnrollInternalContent(req) + assert.NoError(t, err, "Should not get an error when expanding clipset") + + actualJSON, err := json.Marshal(actual) + assert.NoError(t, err, "Expected to marshall correctly") + assert.JSONEq(t, string(expected), string(actualJSON)) +} diff --git a/content/testdata/content-liveblogpackage-valid-request.json b/content/testdata/content-liveblogpackage-valid-request.json new file mode 100644 index 0000000..8b0b60d --- /dev/null +++ b/content/testdata/content-liveblogpackage-valid-request.json @@ -0,0 +1,190 @@ +{ + "accessLevel": "subscribed", + "alternativeTitles": { + "promotionalTitle": "Yen falls below ¥154 for first time since 1990" + }, + "annotations": [], + "apiUrl": "https://api.ft.com/internalcontent/83dd865f-cd5d-48a2-b02f-451c956154b6", + "brands": [ + "http://www.ft.com/thing/dbb0bdae-1f0c-11e4-b0cb-b2227cce2b54" + ], + "byline": "Jaren Kerr, Jonathan Wheatley, Oliver Ralph and William Sandlund", + "canBeDistributed": "yes", + "canBeSyndicated": "yes", + "comments": { + "enabled": false + }, + "containedIn": [], + "contains": [ + { + "apiUrl": "http://api.ft.com/content/333e4730-3908-4172-8b6b-129c58c5738a", + "id": "http://api.ft.com/things/333e4730-3908-4172-8b6b-129c58c5738a" + }, + { + "apiUrl": "http://api.ft.com/content/9ea574aa-d17d-4ba6-8c03-fcf7fd7230c5", + "id": "http://api.ft.com/things/9ea574aa-d17d-4ba6-8c03-fcf7fd7230c5" + }, + { + "apiUrl": "http://api.ft.com/content/1f24a331-d1d9-4ca7-b5d2-ec5883bc5bee", + "id": "http://api.ft.com/things/1f24a331-d1d9-4ca7-b5d2-ec5883bc5bee" + }, + { + "apiUrl": "http://api.ft.com/content/31e2d3d6-0d93-4f68-b1cc-58654477e833", + "id": "http://api.ft.com/things/31e2d3d6-0d93-4f68-b1cc-58654477e833" + }, + { + "apiUrl": "http://api.ft.com/content/3cde82d4-1e9d-47ae-9e9c-42a9441c1d37", + "id": "http://api.ft.com/things/3cde82d4-1e9d-47ae-9e9c-42a9441c1d37" + }, + { + "apiUrl": "http://api.ft.com/content/04b53439-e322-4d47-a0d3-caee1d34b1b6", + "id": "http://api.ft.com/things/04b53439-e322-4d47-a0d3-caee1d34b1b6" + }, + { + "apiUrl": "http://api.ft.com/content/c0a09a67-7966-41d5-876a-9d9b84dbcd49", + "id": "http://api.ft.com/things/c0a09a67-7966-41d5-876a-9d9b84dbcd49" + }, + { + "apiUrl": "http://api.ft.com/content/44e0e2fd-660f-4877-b16b-4dff3d78cc6d", + "id": "http://api.ft.com/things/44e0e2fd-660f-4877-b16b-4dff3d78cc6d" + }, + { + "apiUrl": "http://api.ft.com/content/a7add2dc-6034-4b99-9458-86673335a701", + "id": "http://api.ft.com/things/a7add2dc-6034-4b99-9458-86673335a701" + }, + { + "apiUrl": "http://api.ft.com/content/8e2dc6e9-0e9a-47b1-8173-41cd679f08ce", + "id": "http://api.ft.com/things/8e2dc6e9-0e9a-47b1-8173-41cd679f08ce" + }, + { + "apiUrl": "http://api.ft.com/content/1e68e311-f035-49cc-bb44-d0dfdff39dae", + "id": "http://api.ft.com/things/1e68e311-f035-49cc-bb44-d0dfdff39dae" + }, + { + "apiUrl": "http://api.ft.com/content/0c008c0a-2dd7-497a-bde7-0a4d1a1c6d7b", + "id": "http://api.ft.com/things/0c008c0a-2dd7-497a-bde7-0a4d1a1c6d7b" + }, + { + "apiUrl": "http://api.ft.com/content/90d0d85a-b380-492d-b3fa-2a51b0653cd8", + "id": "http://api.ft.com/things/90d0d85a-b380-492d-b3fa-2a51b0653cd8" + }, + { + "apiUrl": "http://api.ft.com/content/39ddf659-791d-4b6a-93f6-d7d1adb6544c", + "id": "http://api.ft.com/things/39ddf659-791d-4b6a-93f6-d7d1adb6544c" + }, + { + "apiUrl": "http://api.ft.com/content/f49d98f7-5785-4506-a1d6-1fd668afd358", + "id": "http://api.ft.com/things/f49d98f7-5785-4506-a1d6-1fd668afd358" + }, + { + "apiUrl": "http://api.ft.com/content/b1e014c5-4bc2-46ba-9734-6c25e1a56492", + "id": "http://api.ft.com/things/b1e014c5-4bc2-46ba-9734-6c25e1a56492" + }, + { + "apiUrl": "http://api.ft.com/content/071ff504-6479-48ed-b4c3-11f9fbaa4b01", + "id": "http://api.ft.com/things/071ff504-6479-48ed-b4c3-11f9fbaa4b01" + }, + { + "apiUrl": "http://api.ft.com/content/9cc40187-5a64-43cb-ba9a-f3f5b3da654f", + "id": "http://api.ft.com/things/9cc40187-5a64-43cb-ba9a-f3f5b3da654f" + }, + { + "apiUrl": "http://api.ft.com/content/40e56ed9-995c-4951-85f3-1e9f703c6be7", + "id": "http://api.ft.com/things/40e56ed9-995c-4951-85f3-1e9f703c6be7" + }, + { + "apiUrl": "http://api.ft.com/content/e9c92b2e-cf90-4cb0-ab8a-965f07cfb919", + "id": "http://api.ft.com/things/e9c92b2e-cf90-4cb0-ab8a-965f07cfb919" + }, + { + "apiUrl": "http://api.ft.com/content/dc6f2219-d9fe-4d76-ace2-a479c2ad83d1", + "id": "http://api.ft.com/things/dc6f2219-d9fe-4d76-ace2-a479c2ad83d1" + }, + { + "apiUrl": "http://api.ft.com/content/7f7e0e5d-f9b8-4de6-b12f-618ed7282d2d", + "id": "http://api.ft.com/things/7f7e0e5d-f9b8-4de6-b12f-618ed7282d2d" + }, + { + "apiUrl": "http://api.ft.com/content/99cb5aac-c6ad-43cf-9e72-c3ad60b916b8", + "id": "http://api.ft.com/things/99cb5aac-c6ad-43cf-9e72-c3ad60b916b8" + }, + { + "apiUrl": "http://api.ft.com/content/06af11a1-5091-42de-85bd-0595925b7b0e", + "id": "http://api.ft.com/things/06af11a1-5091-42de-85bd-0595925b7b0e" + }, + { + "apiUrl": "http://api.ft.com/content/854a67ce-c5c3-4a6b-be74-a21dcf5d9117", + "id": "http://api.ft.com/things/854a67ce-c5c3-4a6b-be74-a21dcf5d9117" + }, + { + "apiUrl": "http://api.ft.com/content/cb038763-8640-4676-a92b-68a2f99311a3", + "id": "http://api.ft.com/things/cb038763-8640-4676-a92b-68a2f99311a3" + }, + { + "apiUrl": "http://api.ft.com/content/06f0b36d-0c0b-4c7a-8689-254369c280a1", + "id": "http://api.ft.com/things/06f0b36d-0c0b-4c7a-8689-254369c280a1" + }, + { + "apiUrl": "http://api.ft.com/content/44074884-419d-412c-879b-ba680421be01", + "id": "http://api.ft.com/things/44074884-419d-412c-879b-ba680421be01" + }, + { + "apiUrl": "http://api.ft.com/content/22f75ebe-717c-4aed-b0ef-977d3a10b28b", + "id": "http://api.ft.com/things/22f75ebe-717c-4aed-b0ef-977d3a10b28b" + }, + { + "apiUrl": "http://api.ft.com/content/c9746065-1cfe-4286-9bab-dedb585f7675", + "id": "http://api.ft.com/things/c9746065-1cfe-4286-9bab-dedb585f7675" + } + ], + "curatedRelatedContent": [], + "firstPublishedDate": "2024-04-14T22:58:16.812Z", + "id": "http://www.ft.com/thing/83dd865f-cd5d-48a2-b02f-451c956154b6", + "identifiers": [ + { + "authority": "http://api.ft.com/system/cct", + "identifierValue": "83dd865f-cd5d-48a2-b02f-451c956154b6" + } + ], + "lastModified": "2024-04-15T15:20:41.000Z", + "leadImages": [ + { + "id": "https://api.ft.com/content/e1645ef0-7a42-492f-8d43-e3b91f9e0da8", + "type": "standard" + } + ], + "mainImage": { + "id": "https://api.ft.com/content/15f560c5-fa19-4997-aa33-aa3b6638442e" + }, + "pinnedPosts": [ + "44074884-419d-412c-879b-ba680421be01" + ], + "prefLabel": "Live news: Yen falls below ¥154 for first time since 1990", + "publication": [ + "http://www.ft.com/thing/88fdde6c-2aa4-4f78-af02-9f680097cfd6" + ], + "publishReference": "republish_tid_ox3VSSZYjR", + "publishedDate": "2024-04-14T22:58:16.812Z", + "realtime": true, + "requestUrl": "https://api.ft.com/internalcontent/83dd865f-cd5d-48a2-b02f-451c956154b6", + "standout": { + "editorsChoice": false, + "exclusive": false, + "scoop": false + }, + "summary": { + "bodyXML": "" + }, + "title": "Live news: Yen falls below ¥154 for first time since 1990", + "topper": { + "backgroundBox": false, + "backgroundColour": "auto", + "layout": "full-bleed-offset", + "textShadow": false + }, + "type": "http://www.ft.com/ontology/content/LiveBlogPackage", + "types": [ + "http://www.ft.com/ontology/content/LiveBlogPackage" + ], + "webUrl": "https://www.ft.com/content/83dd865f-cd5d-48a2-b02f-451c956154b6" +} \ No newline at end of file diff --git a/content/testdata/content-liveblogpackage-valid-response.json b/content/testdata/content-liveblogpackage-valid-response.json new file mode 100644 index 0000000..0796fda --- /dev/null +++ b/content/testdata/content-liveblogpackage-valid-response.json @@ -0,0 +1,229 @@ +{ + "accessLevel": "subscribed", + "alternativeTitles": { + "promotionalTitle": "Yen falls below ¥154 for first time since 1990" + }, + "annotations": [], + "apiUrl": "https://api.ft.com/internalcontent/83dd865f-cd5d-48a2-b02f-451c956154b6", + "brands": [ + "http://www.ft.com/thing/dbb0bdae-1f0c-11e4-b0cb-b2227cce2b54" + ], + "byline": "Jaren Kerr, Jonathan Wheatley, Oliver Ralph and William Sandlund", + "canBeDistributed": "yes", + "canBeSyndicated": "yes", + "comments": { + "enabled": false + }, + "containedIn": [], + "contains": [ + { + "apiUrl": "http://api.ft.com/content/333e4730-3908-4172-8b6b-129c58c5738a", + "id": "http://api.ft.com/things/333e4730-3908-4172-8b6b-129c58c5738a" + }, + { + "apiUrl": "http://api.ft.com/content/9ea574aa-d17d-4ba6-8c03-fcf7fd7230c5", + "id": "http://api.ft.com/things/9ea574aa-d17d-4ba6-8c03-fcf7fd7230c5" + }, + { + "apiUrl": "http://api.ft.com/content/1f24a331-d1d9-4ca7-b5d2-ec5883bc5bee", + "id": "http://api.ft.com/things/1f24a331-d1d9-4ca7-b5d2-ec5883bc5bee" + }, + { + "apiUrl": "http://api.ft.com/content/31e2d3d6-0d93-4f68-b1cc-58654477e833", + "id": "http://api.ft.com/things/31e2d3d6-0d93-4f68-b1cc-58654477e833" + }, + { + "apiUrl": "http://api.ft.com/content/3cde82d4-1e9d-47ae-9e9c-42a9441c1d37", + "id": "http://api.ft.com/things/3cde82d4-1e9d-47ae-9e9c-42a9441c1d37" + }, + { + "apiUrl": "http://api.ft.com/content/04b53439-e322-4d47-a0d3-caee1d34b1b6", + "id": "http://api.ft.com/things/04b53439-e322-4d47-a0d3-caee1d34b1b6" + }, + { + "apiUrl": "http://api.ft.com/content/c0a09a67-7966-41d5-876a-9d9b84dbcd49", + "id": "http://api.ft.com/things/c0a09a67-7966-41d5-876a-9d9b84dbcd49" + }, + { + "apiUrl": "http://api.ft.com/content/44e0e2fd-660f-4877-b16b-4dff3d78cc6d", + "id": "http://api.ft.com/things/44e0e2fd-660f-4877-b16b-4dff3d78cc6d" + }, + { + "apiUrl": "http://api.ft.com/content/a7add2dc-6034-4b99-9458-86673335a701", + "id": "http://api.ft.com/things/a7add2dc-6034-4b99-9458-86673335a701" + }, + { + "apiUrl": "http://api.ft.com/content/8e2dc6e9-0e9a-47b1-8173-41cd679f08ce", + "id": "http://api.ft.com/things/8e2dc6e9-0e9a-47b1-8173-41cd679f08ce" + }, + { + "apiUrl": "http://api.ft.com/content/1e68e311-f035-49cc-bb44-d0dfdff39dae", + "id": "http://api.ft.com/things/1e68e311-f035-49cc-bb44-d0dfdff39dae" + }, + { + "apiUrl": "http://api.ft.com/content/0c008c0a-2dd7-497a-bde7-0a4d1a1c6d7b", + "id": "http://api.ft.com/things/0c008c0a-2dd7-497a-bde7-0a4d1a1c6d7b" + }, + { + "apiUrl": "http://api.ft.com/content/90d0d85a-b380-492d-b3fa-2a51b0653cd8", + "id": "http://api.ft.com/things/90d0d85a-b380-492d-b3fa-2a51b0653cd8" + }, + { + "apiUrl": "http://api.ft.com/content/39ddf659-791d-4b6a-93f6-d7d1adb6544c", + "id": "http://api.ft.com/things/39ddf659-791d-4b6a-93f6-d7d1adb6544c" + }, + { + "apiUrl": "http://api.ft.com/content/f49d98f7-5785-4506-a1d6-1fd668afd358", + "id": "http://api.ft.com/things/f49d98f7-5785-4506-a1d6-1fd668afd358" + }, + { + "apiUrl": "http://api.ft.com/content/b1e014c5-4bc2-46ba-9734-6c25e1a56492", + "id": "http://api.ft.com/things/b1e014c5-4bc2-46ba-9734-6c25e1a56492" + }, + { + "apiUrl": "http://api.ft.com/content/071ff504-6479-48ed-b4c3-11f9fbaa4b01", + "id": "http://api.ft.com/things/071ff504-6479-48ed-b4c3-11f9fbaa4b01" + }, + { + "apiUrl": "http://api.ft.com/content/9cc40187-5a64-43cb-ba9a-f3f5b3da654f", + "id": "http://api.ft.com/things/9cc40187-5a64-43cb-ba9a-f3f5b3da654f" + }, + { + "apiUrl": "http://api.ft.com/content/40e56ed9-995c-4951-85f3-1e9f703c6be7", + "id": "http://api.ft.com/things/40e56ed9-995c-4951-85f3-1e9f703c6be7" + }, + { + "apiUrl": "http://api.ft.com/content/e9c92b2e-cf90-4cb0-ab8a-965f07cfb919", + "id": "http://api.ft.com/things/e9c92b2e-cf90-4cb0-ab8a-965f07cfb919" + }, + { + "apiUrl": "http://api.ft.com/content/dc6f2219-d9fe-4d76-ace2-a479c2ad83d1", + "id": "http://api.ft.com/things/dc6f2219-d9fe-4d76-ace2-a479c2ad83d1" + }, + { + "apiUrl": "http://api.ft.com/content/7f7e0e5d-f9b8-4de6-b12f-618ed7282d2d", + "id": "http://api.ft.com/things/7f7e0e5d-f9b8-4de6-b12f-618ed7282d2d" + }, + { + "apiUrl": "http://api.ft.com/content/99cb5aac-c6ad-43cf-9e72-c3ad60b916b8", + "id": "http://api.ft.com/things/99cb5aac-c6ad-43cf-9e72-c3ad60b916b8" + }, + { + "apiUrl": "http://api.ft.com/content/06af11a1-5091-42de-85bd-0595925b7b0e", + "id": "http://api.ft.com/things/06af11a1-5091-42de-85bd-0595925b7b0e" + }, + { + "apiUrl": "http://api.ft.com/content/854a67ce-c5c3-4a6b-be74-a21dcf5d9117", + "id": "http://api.ft.com/things/854a67ce-c5c3-4a6b-be74-a21dcf5d9117" + }, + { + "apiUrl": "http://api.ft.com/content/cb038763-8640-4676-a92b-68a2f99311a3", + "id": "http://api.ft.com/things/cb038763-8640-4676-a92b-68a2f99311a3" + }, + { + "apiUrl": "http://api.ft.com/content/06f0b36d-0c0b-4c7a-8689-254369c280a1", + "id": "http://api.ft.com/things/06f0b36d-0c0b-4c7a-8689-254369c280a1" + }, + { + "apiUrl": "http://api.ft.com/content/44074884-419d-412c-879b-ba680421be01", + "id": "http://api.ft.com/things/44074884-419d-412c-879b-ba680421be01" + }, + { + "apiUrl": "http://api.ft.com/content/22f75ebe-717c-4aed-b0ef-977d3a10b28b", + "id": "http://api.ft.com/things/22f75ebe-717c-4aed-b0ef-977d3a10b28b" + }, + { + "apiUrl": "http://api.ft.com/content/c9746065-1cfe-4286-9bab-dedb585f7675", + "id": "http://api.ft.com/things/c9746065-1cfe-4286-9bab-dedb585f7675" + } + ], + "curatedRelatedContent": [], + "firstPublishedDate": "2024-04-14T22:58:16.812Z", + "id": "http://www.ft.com/thing/83dd865f-cd5d-48a2-b02f-451c956154b6", + "identifiers": [ + { + "authority": "http://api.ft.com/system/cct", + "identifierValue": "83dd865f-cd5d-48a2-b02f-451c956154b6" + } + ], + "lastModified": "2024-04-15T15:20:41.000Z", + "leadImages": [ + { + "id": "https://api.ft.com/content/e1645ef0-7a42-492f-8d43-e3b91f9e0da8", + "type": "standard" + } + ], + "mainImage": { + "alternativeImages": {}, + "alternativeStandfirsts": {}, + "alternativeTitles": {}, + "brands": [ + "http://www.ft.com/thing/dbb0bdae-1f0c-11e4-b0cb-b2227cce2b54" + ], + "canBeSyndicated": "verify", + "description": "", + "id": "http://www.ft.com/thing/15f560c5-fa19-4997-aa33-aa3b6638442e", + "members": [ + { + "alternativeImages": {}, + "alternativeStandfirsts": {}, + "alternativeTitles": {}, + "binaryUrl": "https://d1e00ek4ebabms.cloudfront.net/production/e1645ef0-7a42-492f-8d43-e3b91f9e0da8.jpg", + "brands": [ + "http://www.ft.com/thing/dbb0bdae-1f0c-11e4-b0cb-b2227cce2b54" + ], + "canBeSyndicated": "verify", + "description": "", + "firstPublishedDate": "2024-04-15T15:16:44.993Z", + "format": "standard", + "id": "http://www.ft.com/thing/e1645ef0-7a42-492f-8d43-e3b91f9e0da8", + "pixelHeight": 1402, + "pixelWidth": 2492, + "publication": [ + "http://www.ft.com/thing/88fdde6c-2aa4-4f78-af02-9f680097cfd6" + ], + "publishedDate": "2024-04-15T15:16:44.993Z", + "requestUrl": "https://api.ft.com/content/e1645ef0-7a42-492f-8d43-e3b91f9e0da8", + "title": "", + "type": "http://www.ft.com/ontology/content/Image" + } + ], + "publication": [ + "http://www.ft.com/thing/88fdde6c-2aa4-4f78-af02-9f680097cfd6" + ], + "publishedDate": "2024-04-15T15:16:44.994Z", + "requestUrl": "https://api.ft.com/content/15f560c5-fa19-4997-aa33-aa3b6638442e", + "type": "http://www.ft.com/ontology/content/ImageSet" + }, + "pinnedPosts": [ + "44074884-419d-412c-879b-ba680421be01" + ], + "prefLabel": "Live news: Yen falls below ¥154 for first time since 1990", + "publication": [ + "http://www.ft.com/thing/88fdde6c-2aa4-4f78-af02-9f680097cfd6" + ], + "publishReference": "republish_tid_ox3VSSZYjR", + "publishedDate": "2024-04-14T22:58:16.812Z", + "realtime": true, + "requestUrl": "https://api.ft.com/internalcontent/83dd865f-cd5d-48a2-b02f-451c956154b6", + "standout": { + "editorsChoice": false, + "exclusive": false, + "scoop": false + }, + "summary": { + "bodyXML": "" + }, + "title": "Live news: Yen falls below ¥154 for first time since 1990", + "topper": { + "backgroundBox": false, + "backgroundColour": "auto", + "layout": "full-bleed-offset", + "textShadow": false + }, + "type": "http://www.ft.com/ontology/content/LiveBlogPackage", + "types": [ + "http://www.ft.com/ontology/content/LiveBlogPackage" + ], + "webUrl": "https://www.ft.com/content/83dd865f-cd5d-48a2-b02f-451c956154b6" +} \ No newline at end of file diff --git a/content/testdata/internalcontent-contentpackage-valid-request.json b/content/testdata/internalcontent-contentpackage-valid-request.json new file mode 100644 index 0000000..1beca96 --- /dev/null +++ b/content/testdata/internalcontent-contentpackage-valid-request.json @@ -0,0 +1,90 @@ +{ + "accessLevel": "free", + "alternativeTitles": { + "promotionalTitle": "Innovation in Energy" + }, + "annotations": [], + "apiUrl": "https://api.ft.com/internalcontent/40409b13-20a5-4cf1-a4cb-159daa48134d", + "bodyXML": "", + "brands": [ + "http://www.ft.com/thing/dbb0bdae-1f0c-11e4-b0cb-b2227cce2b54" + ], + "canBeDistributed": "yes", + "canBeSyndicated": "yes", + "containedIn": [], + "contains": [ + { + "apiUrl": "http://api.ft.com/content/2401d64e-f23e-48a6-9a0b-9ee5d777e5e4", + "id": "http://api.ft.com/things/2401d64e-f23e-48a6-9a0b-9ee5d777e5e4" + }, + { + "apiUrl": "http://api.ft.com/content/a2602177-7ba0-470b-abfb-8cae5ef5e4a5", + "id": "http://api.ft.com/things/a2602177-7ba0-470b-abfb-8cae5ef5e4a5" + }, + { + "apiUrl": "http://api.ft.com/content/50656582-8b42-47d9-9bcf-decb0f976dd3", + "id": "http://api.ft.com/things/50656582-8b42-47d9-9bcf-decb0f976dd3" + }, + { + "apiUrl": "http://api.ft.com/content/55bc9d43-1260-49ca-8a3d-0f25ae712e23", + "id": "http://api.ft.com/things/55bc9d43-1260-49ca-8a3d-0f25ae712e23" + }, + { + "apiUrl": "http://api.ft.com/content/5de1a278-9d49-441d-ab67-fe6aa0f3ec9b", + "id": "http://api.ft.com/things/5de1a278-9d49-441d-ab67-fe6aa0f3ec9b" + }, + { + "apiUrl": "http://api.ft.com/content/4bc25fa2-acb3-461f-b1f3-548f82b78b5b", + "id": "http://api.ft.com/things/4bc25fa2-acb3-461f-b1f3-548f82b78b5b" + } + ], + "curatedRelatedContent": [], + "design": { + "theme": "special-report" + }, + "firstPublishedDate": "2023-02-07T05:03:49.926Z", + "id": "http://www.ft.com/thing/40409b13-20a5-4cf1-a4cb-159daa48134d", + "leadImages": [ + { + "id": "https://api.ft.com/content/828e9a62-014f-445c-a7dd-a879d64f6cca", + "type": "standard" + }, + { + "id": "https://api.ft.com/content/e9491ffe-d894-4773-8510-a2b2dba51ef6", + "type": "square" + }, + { + "id": "https://api.ft.com/content/f85130c2-c3ce-4359-afd8-a2278ba99939", + "type": "wide" + } + ], + "prefLabel": "Innovation in Energy", + "publishedDate": "2023-02-07T05:03:49.926Z", + "requestUrl": "https://api.ft.com/internalcontent/40409b13-20a5-4cf1-a4cb-159daa48134d", + "standfirst": "New technologies — ranging from wireless vehicle charging pads to domestic heat pumps — plus older solutions, such as sail-power, are helping to limit the impact of climate change. But spending on research needs to increase to achieve global goals", + "standout": { + "editorsChoice": false, + "exclusive": false, + "scoop": false + }, + "summary": { + "bodyXML": "" + }, + "tableOfContents": { + "labelType": "none", + "sequence": "none" + }, + "title": "Innovation in Energy", + "topper": { + "backgroundBox": false, + "backgroundColour": "auto", + "layout": "split-text-left", + "textShadow": false + }, + "type": "http://www.ft.com/ontology/content/ContentPackage", + "types": [ + "http://www.ft.com/ontology/content/ContentPackage" + ], + "webUrl": "https://www.ft.com/content/40409b13-20a5-4cf1-a4cb-159daa48134d", + "canonicalWebUrl": "https://www.ft.com/content/40409b13-20a5-4cf1-a4cb-159daa48134d" +} \ No newline at end of file diff --git a/content/testdata/internalcontent-contentpackage-valid-response.json b/content/testdata/internalcontent-contentpackage-valid-response.json new file mode 100644 index 0000000..00b6c5a --- /dev/null +++ b/content/testdata/internalcontent-contentpackage-valid-response.json @@ -0,0 +1,150 @@ +{ + "accessLevel": "free", + "alternativeTitles": { + "promotionalTitle": "Innovation in Energy" + }, + "annotations": [], + "apiUrl": "https://api.ft.com/internalcontent/40409b13-20a5-4cf1-a4cb-159daa48134d", + "bodyXML": "", + "brands": [ + "http://www.ft.com/thing/dbb0bdae-1f0c-11e4-b0cb-b2227cce2b54" + ], + "canBeDistributed": "yes", + "canBeSyndicated": "yes", + "canonicalWebUrl": "https://www.ft.com/content/40409b13-20a5-4cf1-a4cb-159daa48134d", + "containedIn": [], + "contains": [ + { + "apiUrl": "http://api.ft.com/content/2401d64e-f23e-48a6-9a0b-9ee5d777e5e4", + "id": "http://api.ft.com/things/2401d64e-f23e-48a6-9a0b-9ee5d777e5e4" + }, + { + "apiUrl": "http://api.ft.com/content/a2602177-7ba0-470b-abfb-8cae5ef5e4a5", + "id": "http://api.ft.com/things/a2602177-7ba0-470b-abfb-8cae5ef5e4a5" + }, + { + "apiUrl": "http://api.ft.com/content/50656582-8b42-47d9-9bcf-decb0f976dd3", + "id": "http://api.ft.com/things/50656582-8b42-47d9-9bcf-decb0f976dd3" + }, + { + "apiUrl": "http://api.ft.com/content/55bc9d43-1260-49ca-8a3d-0f25ae712e23", + "id": "http://api.ft.com/things/55bc9d43-1260-49ca-8a3d-0f25ae712e23" + }, + { + "apiUrl": "http://api.ft.com/content/5de1a278-9d49-441d-ab67-fe6aa0f3ec9b", + "id": "http://api.ft.com/things/5de1a278-9d49-441d-ab67-fe6aa0f3ec9b" + }, + { + "apiUrl": "http://api.ft.com/content/4bc25fa2-acb3-461f-b1f3-548f82b78b5b", + "id": "http://api.ft.com/things/4bc25fa2-acb3-461f-b1f3-548f82b78b5b" + } + ], + "curatedRelatedContent": [], + "design": { + "theme": "special-report" + }, + "firstPublishedDate": "2023-02-07T05:03:49.926Z", + "id": "http://www.ft.com/thing/40409b13-20a5-4cf1-a4cb-159daa48134d", + "leadImages": [ + { + "id": "https://api.ft.com/content/828e9a62-014f-445c-a7dd-a879d64f6cca", + "image": { + "alternativeImages": {}, + "alternativeStandfirsts": {}, + "alternativeTitles": {}, + "binaryUrl": "https://d1e00ek4ebabms.cloudfront.net/production/828e9a62-014f-445c-a7dd-a879d64f6cca.jpg", + "brands": [ + "http://www.ft.com/thing/dbb0bdae-1f0c-11e4-b0cb-b2227cce2b54" + ], + "canBeSyndicated": "verify", + "copyright": { + "notice": "© Jeremy Sutton-Hibbert" + }, + "description": "two men on a boat on its way to a tidal turbine", + "firstPublishedDate": "2023-02-07T05:03:49.945Z", + "id": "http://www.ft.com/thing/828e9a62-014f-445c-a7dd-a879d64f6cca", + "publishedDate": "2023-02-07T05:03:49.945Z", + "requestUrl": "https://api-t.ft.com/content/828e9a62-014f-445c-a7dd-a879d64f6cca", + "title": "", + "type": "http://www.ft.com/ontology/content/Image" + }, + "type": "standard" + }, + { + "id": "https://api.ft.com/content/e9491ffe-d894-4773-8510-a2b2dba51ef6", + "image": { + "alternativeImages": {}, + "alternativeStandfirsts": {}, + "alternativeTitles": {}, + "binaryUrl": "https://d1e00ek4ebabms.cloudfront.net/production/e9491ffe-d894-4773-8510-a2b2dba51ef6.jpg", + "brands": [ + "http://www.ft.com/thing/dbb0bdae-1f0c-11e4-b0cb-b2227cce2b54" + ], + "canBeSyndicated": "verify", + "copyright": { + "notice": "© Jeremy Sutton-Hibbert" + }, + "description": "two men on a boat on its way to a tidal turbine", + "firstPublishedDate": "2023-02-07T05:03:49.947Z", + "id": "http://www.ft.com/thing/e9491ffe-d894-4773-8510-a2b2dba51ef6", + "publishedDate": "2023-02-07T05:03:49.947Z", + "requestUrl": "https://api-t.ft.com/content/e9491ffe-d894-4773-8510-a2b2dba51ef6", + "title": "", + "type": "http://www.ft.com/ontology/content/Image" + }, + "type": "square" + }, + { + "id": "https://api.ft.com/content/f85130c2-c3ce-4359-afd8-a2278ba99939", + "image": { + "alternativeImages": {}, + "alternativeStandfirsts": {}, + "alternativeTitles": {}, + "binaryUrl": "https://d1e00ek4ebabms.cloudfront.net/production/f85130c2-c3ce-4359-afd8-a2278ba99939.jpg", + "brands": [ + "http://www.ft.com/thing/dbb0bdae-1f0c-11e4-b0cb-b2227cce2b54" + ], + "canBeSyndicated": "verify", + "copyright": { + "notice": "© Jeremy Sutton-Hibbert" + }, + "description": "two men on a boat on its way to a tidal turbine", + "firstPublishedDate": "2023-02-07T05:03:49.948Z", + "id": "http://www.ft.com/thing/f85130c2-c3ce-4359-afd8-a2278ba99939", + "publishedDate": "2023-02-07T05:03:49.948Z", + "requestUrl": "https://api-t.ft.com/content/f85130c2-c3ce-4359-afd8-a2278ba99939", + "title": "", + "type": "http://www.ft.com/ontology/content/Image" + }, + "type": "wide" + } + ], + "prefLabel": "Innovation in Energy", + "publishedDate": "2023-02-07T05:03:49.926Z", + "requestUrl": "https://api.ft.com/internalcontent/40409b13-20a5-4cf1-a4cb-159daa48134d", + "standfirst": "New technologies — ranging from wireless vehicle charging pads to domestic heat pumps — plus older solutions, such as sail-power, are helping to limit the impact of climate change. But spending on research needs to increase to achieve global goals", + "standout": { + "editorsChoice": false, + "exclusive": false, + "scoop": false + }, + "summary": { + "bodyXML": "" + }, + "tableOfContents": { + "labelType": "none", + "sequence": "none" + }, + "title": "Innovation in Energy", + "topper": { + "backgroundBox": false, + "backgroundColour": "auto", + "layout": "split-text-left", + "textShadow": false + }, + "type": "http://www.ft.com/ontology/content/ContentPackage", + "types": [ + "http://www.ft.com/ontology/content/ContentPackage" + ], + "webUrl": "https://www.ft.com/content/40409b13-20a5-4cf1-a4cb-159daa48134d" +} \ No newline at end of file diff --git a/content/testdata/reader-content-liveblogpackage-valid-response.json b/content/testdata/reader-content-liveblogpackage-valid-response.json new file mode 100644 index 0000000..4a15f9a --- /dev/null +++ b/content/testdata/reader-content-liveblogpackage-valid-response.json @@ -0,0 +1,50 @@ +{ + "15f560c5-fa19-4997-aa33-aa3b6638442e": { + "alternativeImages": { + }, + "alternativeStandfirsts": { + }, + "alternativeTitles": { + }, + "brands": [ + "http://www.ft.com/thing/dbb0bdae-1f0c-11e4-b0cb-b2227cce2b54" + ], + "canBeSyndicated": "verify", + "description": "", + "id": "http://www.ft.com/thing/15f560c5-fa19-4997-aa33-aa3b6638442e", + "members": [ + { + "format": "standard", + "id": "https://api.ft.com/content/e1645ef0-7a42-492f-8d43-e3b91f9e0da8" + } + ], + "publication": [ + "http://www.ft.com/thing/88fdde6c-2aa4-4f78-af02-9f680097cfd6" + ], + "publishedDate": "2024-04-15T15:16:44.994Z", + "requestUrl": "https://api.ft.com/content/15f560c5-fa19-4997-aa33-aa3b6638442e", + "type": "http://www.ft.com/ontology/content/ImageSet" + }, + "e1645ef0-7a42-492f-8d43-e3b91f9e0da8": { + "id": "http://www.ft.com/thing/e1645ef0-7a42-492f-8d43-e3b91f9e0da8", + "type": "http://www.ft.com/ontology/content/Image", + "title": "", + "alternativeTitles": {}, + "alternativeStandfirsts": {}, + "description": "", + "firstPublishedDate": "2024-04-15T15:16:44.993Z", + "publishedDate": "2024-04-15T15:16:44.993Z", + "requestUrl": "https://api.ft.com/content/e1645ef0-7a42-492f-8d43-e3b91f9e0da8", + "binaryUrl": "https://d1e00ek4ebabms.cloudfront.net/production/e1645ef0-7a42-492f-8d43-e3b91f9e0da8.jpg", + "pixelWidth": 2492, + "pixelHeight": 1402, + "brands": [ + "http://www.ft.com/thing/dbb0bdae-1f0c-11e4-b0cb-b2227cce2b54" + ], + "alternativeImages": {}, + "publication": [ + "http://www.ft.com/thing/88fdde6c-2aa4-4f78-af02-9f680097cfd6" + ], + "canBeSyndicated": "verify" + } +} \ No newline at end of file diff --git a/content/testdata/reader-internalcontent-contentpackage-valid-response.json b/content/testdata/reader-internalcontent-contentpackage-valid-response.json new file mode 100644 index 0000000..ab6ee9b --- /dev/null +++ b/content/testdata/reader-internalcontent-contentpackage-valid-response.json @@ -0,0 +1,62 @@ +{ + "828e9a62-014f-445c-a7dd-a879d64f6cca": { + "id": "http://www.ft.com/thing/828e9a62-014f-445c-a7dd-a879d64f6cca", + "type": "http://www.ft.com/ontology/content/Image", + "title": "", + "alternativeTitles": {}, + "alternativeStandfirsts": {}, + "description": "two men on a boat on its way to a tidal turbine", + "firstPublishedDate": "2023-02-07T05:03:49.945Z", + "publishedDate": "2023-02-07T05:03:49.945Z", + "requestUrl": "https://api-t.ft.com/content/828e9a62-014f-445c-a7dd-a879d64f6cca", + "binaryUrl": "https://d1e00ek4ebabms.cloudfront.net/production/828e9a62-014f-445c-a7dd-a879d64f6cca.jpg", + "brands": [ + "http://www.ft.com/thing/dbb0bdae-1f0c-11e4-b0cb-b2227cce2b54" + ], + "alternativeImages": {}, + "copyright": { + "notice": "© Jeremy Sutton-Hibbert" + }, + "canBeSyndicated": "verify" + }, + "e9491ffe-d894-4773-8510-a2b2dba51ef6": { + "id": "http://www.ft.com/thing/e9491ffe-d894-4773-8510-a2b2dba51ef6", + "type": "http://www.ft.com/ontology/content/Image", + "title": "", + "alternativeTitles": {}, + "alternativeStandfirsts": {}, + "description": "two men on a boat on its way to a tidal turbine", + "firstPublishedDate": "2023-02-07T05:03:49.947Z", + "publishedDate": "2023-02-07T05:03:49.947Z", + "requestUrl": "https://api-t.ft.com/content/e9491ffe-d894-4773-8510-a2b2dba51ef6", + "binaryUrl": "https://d1e00ek4ebabms.cloudfront.net/production/e9491ffe-d894-4773-8510-a2b2dba51ef6.jpg", + "brands": [ + "http://www.ft.com/thing/dbb0bdae-1f0c-11e4-b0cb-b2227cce2b54" + ], + "alternativeImages": {}, + "copyright": { + "notice": "© Jeremy Sutton-Hibbert" + }, + "canBeSyndicated": "verify" + }, + "f85130c2-c3ce-4359-afd8-a2278ba99939": { + "id": "http://www.ft.com/thing/f85130c2-c3ce-4359-afd8-a2278ba99939", + "type": "http://www.ft.com/ontology/content/Image", + "title": "", + "alternativeTitles": {}, + "alternativeStandfirsts": {}, + "description": "two men on a boat on its way to a tidal turbine", + "firstPublishedDate": "2023-02-07T05:03:49.948Z", + "publishedDate": "2023-02-07T05:03:49.948Z", + "requestUrl": "https://api-t.ft.com/content/f85130c2-c3ce-4359-afd8-a2278ba99939", + "binaryUrl": "https://d1e00ek4ebabms.cloudfront.net/production/f85130c2-c3ce-4359-afd8-a2278ba99939.jpg", + "brands": [ + "http://www.ft.com/thing/dbb0bdae-1f0c-11e4-b0cb-b2227cce2b54" + ], + "alternativeImages": {}, + "copyright": { + "notice": "© Jeremy Sutton-Hibbert" + }, + "canBeSyndicated": "verify" + } +} \ No newline at end of file