mirror of
http://88.130.71.182:3000/BlitTech/contexta_be.git
synced 2026-06-12 23:23:21 +00:00
fixed the RAg in test pipeline issue
This commit is contained in:
@@ -185,7 +185,7 @@ class TestMarketplaceRating:
|
||||
assert resp.status_code == 404
|
||||
|
||||
def test_rate_chatbot_success(self, client):
|
||||
bot = {"id": "bot-1", "average_rating": 4.0}
|
||||
bot = {"id": "bot-1", "average_rating": 4.0, "rating_count": 1}
|
||||
with patch("app.routers.marketplace.get_supabase") as mock_sb:
|
||||
mock_sb.return_value = _make_marketplace_sb(chatbot_data=[bot])
|
||||
resp = client.post(
|
||||
@@ -195,12 +195,12 @@ class TestMarketplaceRating:
|
||||
)
|
||||
assert resp.status_code == 200
|
||||
body = resp.json()
|
||||
assert "new_average" in body
|
||||
assert body["new_average"] == 4.5 # (4.0 + 5) / 2
|
||||
assert "average_rating" in body
|
||||
assert body["average_rating"] == 4.5 # (4.0 * 1 + 5) / 2
|
||||
|
||||
def test_rate_chatbot_first_rating(self, client):
|
||||
"""When average_rating is None, should use the submitted rating as both sides."""
|
||||
bot = {"id": "bot-1", "average_rating": None}
|
||||
"""When average_rating is None, should use the submitted rating as the new average."""
|
||||
bot = {"id": "bot-1", "average_rating": None, "rating_count": 0}
|
||||
with patch("app.routers.marketplace.get_supabase") as mock_sb:
|
||||
mock_sb.return_value = _make_marketplace_sb(chatbot_data=[bot])
|
||||
resp = client.post(
|
||||
@@ -209,4 +209,4 @@ class TestMarketplaceRating:
|
||||
headers=AUTH,
|
||||
)
|
||||
assert resp.status_code == 200
|
||||
assert resp.json()["new_average"] == 5.0
|
||||
assert resp.json()["average_rating"] == 5.0
|
||||
|
||||
Reference in New Issue
Block a user