Skip to content

Commit

Permalink
Fix local API tests (#1792)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesbiggs authored Feb 3, 2025
1 parent 183120c commit cee2a9d
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 18 deletions.
4 changes: 2 additions & 2 deletions etna/api/tests/expected_results/article.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": ARTICLE_ID,
"meta": {
"type": "articles.ArticlePage",
"detail_url": "/api/v2/pages/ARTICLE_ID/",
"detail_url": "WAGTAILAPI_BASE_URL/api/v2/pages/ARTICLE_ID/",
"html_url": "http://localhost/article_index/article/",
"slug": "article",
"show_in_menus": false,
Expand All @@ -14,7 +14,7 @@
"id": ARTICLE_INDEX_ID,
"meta": {
"type": "articles.ArticleIndexPage",
"detail_url": "/api/v2/pages/ARTICLE_INDEX_ID/",
"detail_url": "WAGTAILAPI_BASE_URL/api/v2/pages/ARTICLE_INDEX_ID/",
"html_url": "http://localhost/article_index/"
},
"title": "article_index"
Expand Down
4 changes: 2 additions & 2 deletions etna/api/tests/expected_results/article_index.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": ARTICLE_INDEX_ID,
"meta": {
"type": "articles.ArticleIndexPage",
"detail_url": "/api/v2/pages/ARTICLE_INDEX_ID/",
"detail_url": "WAGTAILAPI_BASE_URL/api/v2/pages/ARTICLE_INDEX_ID/",
"html_url": "http://localhost/article_index/",
"slug": "article_index",
"show_in_menus": false,
Expand All @@ -14,7 +14,7 @@
"id": HOME_PAGE_ID,
"meta": {
"type": "home.HomePage",
"detail_url": "/api/v2/pages/HOME_PAGE_ID/",
"detail_url": "WAGTAILAPI_BASE_URL/api/v2/pages/HOME_PAGE_ID/",
"html_url": "http://localhost/"
},
"title": "Home"
Expand Down
4 changes: 2 additions & 2 deletions etna/api/tests/expected_results/arts.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": ARTS_ID,
"meta": {
"type": "collections.TopicExplorerPage",
"detail_url": "/api/v2/pages/ARTS_ID/",
"detail_url": "WAGTAILAPI_BASE_URL/api/v2/pages/ARTS_ID/",
"html_url": "http://localhost/arts/",
"slug": "arts",
"show_in_menus": false,
Expand All @@ -14,7 +14,7 @@
"id": 3,
"meta": {
"type": "home.HomePage",
"detail_url": "/api/v2/pages/3/",
"detail_url": "WAGTAILAPI_BASE_URL/api/v2/pages/3/",
"html_url": "http://localhost/"
},
"title": "Home"
Expand Down
4 changes: 2 additions & 2 deletions etna/api/tests/expected_results/author.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": AUTHOR_ID,
"meta": {
"type": "people.PersonPage",
"detail_url": "/api/v2/pages/AUTHOR_ID/",
"detail_url": "WAGTAILAPI_BASE_URL/api/v2/pages/AUTHOR_ID/",
"html_url": "http://localhost/people/author/",
"slug": "author",
"show_in_menus": false,
Expand All @@ -14,7 +14,7 @@
"id": AUTHOR_INDEX_ID,
"meta": {
"type": "people.PeopleIndexPage",
"detail_url": "/api/v2/pages/AUTHOR_INDEX_ID/",
"detail_url": "WAGTAILAPI_BASE_URL/api/v2/pages/AUTHOR_INDEX_ID/",
"html_url": "http://localhost/people/"
},
"title": "people"
Expand Down
4 changes: 2 additions & 2 deletions etna/api/tests/expected_results/early_modern.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": EARLY_MODERN_ID,
"meta": {
"type": "collections.TimePeriodExplorerPage",
"detail_url": "/api/v2/pages/EARLY_MODERN_ID/",
"detail_url": "WAGTAILAPI_BASE_URL/api/v2/pages/EARLY_MODERN_ID/",
"html_url": "http://localhost/early_modern/",
"slug": "early_modern",
"show_in_menus": false,
Expand All @@ -14,7 +14,7 @@
"id": 3,
"meta": {
"type": "home.HomePage",
"detail_url": "/api/v2/pages/3/",
"detail_url": "WAGTAILAPI_BASE_URL/api/v2/pages/3/",
"html_url": "http://localhost/"
},
"title": "Home"
Expand Down
4 changes: 2 additions & 2 deletions etna/api/tests/expected_results/focused_article.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": FOCUSED_ID,
"meta": {
"type": "articles.FocusedArticlePage",
"detail_url": "/api/v2/pages/FOCUSED_ID/",
"detail_url": "WAGTAILAPI_BASE_URL/api/v2/pages/FOCUSED_ID/",
"html_url": "http://localhost/article_index/focused_article/",
"slug": "focused_article",
"show_in_menus": false,
Expand All @@ -14,7 +14,7 @@
"id": ARTICLE_INDEX_ID,
"meta": {
"type": "articles.ArticleIndexPage",
"detail_url": "/api/v2/pages/ARTICLE_INDEX_ID/",
"detail_url": "WAGTAILAPI_BASE_URL/api/v2/pages/ARTICLE_INDEX_ID/",
"html_url": "http://localhost/article_index/"
},
"title": "article_index"
Expand Down
4 changes: 2 additions & 2 deletions etna/api/tests/expected_results/highlight_gallery.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": HIGHLIGHT_GALLERY_ID,
"meta": {
"type": "collections.HighlightGalleryPage",
"detail_url": "/api/v2/pages/HIGHLIGHT_GALLERY_ID/",
"detail_url": "WAGTAILAPI_BASE_URL/api/v2/pages/HIGHLIGHT_GALLERY_ID/",
"html_url": "http://localhost/arts/highlight_gallery/",
"slug": "highlight_gallery",
"show_in_menus": false,
Expand All @@ -14,7 +14,7 @@
"id": ARTS_ID,
"meta": {
"type": "collections.TopicExplorerPage",
"detail_url": "/api/v2/pages/ARTS_ID/",
"detail_url": "WAGTAILAPI_BASE_URL/api/v2/pages/ARTS_ID/",
"html_url": "http://localhost/arts/"
},
"title": "arts"
Expand Down
4 changes: 2 additions & 2 deletions etna/api/tests/expected_results/people.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": AUTHOR_INDEX_ID,
"meta": {
"type": "people.PeopleIndexPage",
"detail_url": "/api/v2/pages/AUTHOR_INDEX_ID/",
"detail_url": "WAGTAILAPI_BASE_URL/api/v2/pages/AUTHOR_INDEX_ID/",
"html_url": "http://localhost/people/",
"slug": "people",
"show_in_menus": false,
Expand All @@ -14,7 +14,7 @@
"id": 3,
"meta": {
"type": "home.HomePage",
"detail_url": "/api/v2/pages/3/",
"detail_url": "WAGTAILAPI_BASE_URL/api/v2/pages/3/",
"html_url": "http://localhost/"
},
"title": "Home"
Expand Down
4 changes: 2 additions & 2 deletions etna/api/tests/expected_results/postwar.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": POSTWAR_ID,
"meta": {
"type": "collections.TimePeriodExplorerPage",
"detail_url": "/api/v2/pages/POSTWAR_ID/",
"detail_url": "WAGTAILAPI_BASE_URL/api/v2/pages/POSTWAR_ID/",
"html_url": "http://localhost/postwar/",
"slug": "postwar",
"show_in_menus": false,
Expand All @@ -14,7 +14,7 @@
"id": 3,
"meta": {
"type": "home.HomePage",
"detail_url": "/api/v2/pages/3/",
"detail_url": "WAGTAILAPI_BASE_URL/api/v2/pages/3/",
"html_url": "http://localhost/"
},
"title": "Home"
Expand Down
2 changes: 2 additions & 0 deletions etna/api/tests/test_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import re
from datetime import datetime, timezone

from django.conf import settings
from wagtail.models import Site
from wagtail.test.utils import WagtailPageTestCase
from wagtail_factories import ImageFactory
Expand Down Expand Up @@ -352,6 +353,7 @@ def replace_placeholders(self, data: str):
"AUTHOR_INDEX_ID": str(self.author_index_page.id),
"AUTHOR_ID": str(self.author_page.id),
"HIGHLIGHT_GALLERY_ID": str(self.highlight_gallery.id),
"WAGTAILAPI_BASE_URL": str(settings.WAGTAILAPI_BASE_URL),
}

for placeholder, id in placeholder_ids.items():
Expand Down

0 comments on commit cee2a9d

Please sign in to comment.