-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
templates: Ensure that the link in the news in the front page work
- Loading branch information
Showing
2 changed files
with
32 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
"""Tests for the display experiment exclusion feature.""" | ||
|
||
import pytest | ||
from bs4 import BeautifulSoup | ||
from invenio_indexer.api import RecordIndexer | ||
|
||
from cernopendata.modules.fixtures.cli import create_doc | ||
from cernopendata.modules.pages.views import index | ||
|
||
|
||
def test_news(app, database, search): | ||
"""Test that news are displayed properly.""" | ||
# Let's start by inserting a news item | ||
data = { | ||
"$schema": app.extensions["invenio-jsonschemas"].path_to_url( | ||
"records/docs-v1.0.0.json" | ||
), | ||
"type": {"primary": "news"}, | ||
"slug": "dummy_news", | ||
"date_published": "2024-11-27", | ||
"featured": 1, | ||
"title": "DUMMY TEST NEWS", | ||
} | ||
record = create_doc(data, True) | ||
|
||
RecordIndexer().index(record, arguments={"refresh":"wait_for"}) | ||
with app.test_request_context("/"): | ||
soup = BeautifulSoup(index(), "html.parser") | ||
news = soup.find_all("div", class_="news-card") | ||
assert len(news) == 1 | ||
assert news[0].h4.a["href"] == "/docs/dummy_news" |