Simplify by using method _get_reviews

This commit is contained in:
Rui Alves 2024-11-24 17:28:36 +00:00
parent 6a70e9bd44
commit bb0c54e3df

View File

@ -527,12 +527,9 @@ class TestHttpReview(BaseTestHttp):
assert response_json["success"] == True
assert response_json["message"] == "Delete reviews"
# Verify that in DB the review segment was not deleted
review_segment_in_db = (
ReviewSegment.select(ReviewSegment.id)
.where(ReviewSegment.id == id)
.get()
)
assert review_segment_in_db.id == id
review_ids_in_db_after = self._get_reviews([id])
assert len(review_ids_in_db_after) == 1
assert review_ids_in_db_after[0].id == id
def test_post_reviews_delete(self):
with TestClient(self.app) as client:
@ -545,12 +542,8 @@ class TestHttpReview(BaseTestHttp):
assert response_json["success"] == True
assert response_json["message"] == "Delete reviews"
# Verify that in DB the review segment was deleted
review_segment_in_db = (
ReviewSegment.select(ReviewSegment.id)
.where(ReviewSegment.id == id)
.get_or_none()
)
assert review_segment_in_db == None
review_ids_in_db_after = self._get_reviews([id])
assert len(review_ids_in_db_after) == 0
def test_post_reviews_delete_many(self):
with TestClient(self.app) as client: