from atlas_um.api.v1 import schemas class TestPaginatedApiResponseSchema: def test_skip_none(self, faker): res = schemas.PaginatedApiResponseSchema().dump( { "count": faker.pyint(), "limit": faker.pyint(), "items": [], "previous": None, "next": None, } ) assert "previous" not in res assert "next" not in res previous = faker.url() next = faker.url() res = schemas.PaginatedApiResponseSchema().dump( { "count": faker.pyint(), "limit": faker.pyint(), "items": [], "previous": previous, "next": next, } ) assert res.get("previous") == previous assert res.get("next") == next