Commit eb11b3c1 authored by Andreas Burbach's avatar Andreas Burbach
Browse files

add more tests

parent 0f5173d3
Pipeline #76048 passed with stages
in 1 minute and 1 second
...@@ -618,7 +618,7 @@ class TestGetStatementFeed(APITestCase): ...@@ -618,7 +618,7 @@ class TestGetStatementFeed(APITestCase):
def test_feed_contains_correct_data_pagination(self): def test_feed_contains_correct_data_pagination(self):
self.client.credentials(HTTP_AUTHORIZATION='Token ' + str(self.token_beate)) self.client.credentials(HTTP_AUTHORIZATION='Token ' + str(self.token_beate))
response: Response = self.client.get(path="/contents/statements/feed/pagination/?page=1&size=5") response: Response = self.client.get(path="/contents/statements/feed/pagination/?page=1&size=3")
result = response.data["data"] result = response.data["data"]
result_total = response.data["total"] result_total = response.data["total"]
self.assertTrue(len(result), 3) self.assertTrue(len(result), 3)
...@@ -631,6 +631,22 @@ class TestGetStatementFeed(APITestCase): ...@@ -631,6 +631,22 @@ class TestGetStatementFeed(APITestCase):
self.assertTrue(result[1].get("id") > result[2].get("id")) self.assertTrue(result[1].get("id") > result[2].get("id"))
self.assertTrue(result[1].get("created") > result[2].get("created")) self.assertTrue(result[1].get("created") > result[2].get("created"))
def test_feed_load_over_size_pagination(self):
self.client.credentials(HTTP_AUTHORIZATION='Token ' + str(self.token_beate))
response: Response = self.client.get(path="/contents/statements/feed/pagination/?page=1&size=4")
result = response.data["data"]
result_total = response.data["total"]
self.assertTrue(len(result), 3)
self.assertTrue(result_total, 3)
def test_feed_load_under_size_pagination(self):
self.client.credentials(HTTP_AUTHORIZATION='Token ' + str(self.token_beate))
response: Response = self.client.get(path="/contents/statements/feed/pagination/?page=1&size=2")
result = response.data["data"]
result_total = response.data["total"]
self.assertTrue(len(result), 2)
self.assertTrue(result_total, 3)
def test_feed_contains_no_data_pagination(self): def test_feed_contains_no_data_pagination(self):
self.client.credentials(HTTP_AUTHORIZATION='Token ' + str(self.token_beate)) self.client.credentials(HTTP_AUTHORIZATION='Token ' + str(self.token_beate))
response: Response = self.client.get(path="/contents/statements/feed/pagination/?page=2&size=2") response: Response = self.client.get(path="/contents/statements/feed/pagination/?page=2&size=2")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment