Coverage for src/tests/api/v1/portal/endpoints/test_news.py: 100%

11 statements  

« prev     ^ index     » next       coverage.py v7.11.0, created at 2024-01-01 00:00 +0000

1"""Module for testing the portal news endpoints.""" 

2 

3import pytest 

4 

5from fastapi import status 

6from fastapi.testclient import TestClient 

7 

8 

9pytestmark = pytest.mark.api 

10 

11 

12def test_get_news(client: TestClient): 

13 """Test the get news stories api.""" 

14 response = client.get("/api/v1/portal/news") 

15 assert response.status_code == status.HTTP_200_OK 

16 

17 json = response.json() 

18 assert "meta" in json, "There should be a meta object in the response" 

19 assert json["meta"]["limit"] == 10, "The limit should be 10" 

20 assert "data" in json, "There should be a data list in the response"