fix(api): avoid distinct on json product fields in shopping suggestions
This commit is contained in:
parent
fecfa0b9e4
commit
cebea2ac86
2 changed files with 21 additions and 4 deletions
|
|
@ -87,6 +87,23 @@ def test_suggest_shopping(client, session):
|
|||
with patch(
|
||||
"innercontext.api.products.call_gemini_with_function_tools"
|
||||
) as mock_gemini:
|
||||
product = Product(
|
||||
id=uuid.uuid4(),
|
||||
short_id=str(uuid.uuid4())[:8],
|
||||
name="Owned Serum",
|
||||
brand="BrandX",
|
||||
category="serum",
|
||||
recommended_time="both",
|
||||
leave_on=True,
|
||||
product_effect_profile={},
|
||||
)
|
||||
session.add(product)
|
||||
session.commit()
|
||||
session.add(
|
||||
ProductInventory(id=uuid.uuid4(), product_id=product.id, is_opened=True)
|
||||
)
|
||||
session.commit()
|
||||
|
||||
mock_response = type(
|
||||
"Response",
|
||||
(),
|
||||
|
|
@ -94,7 +111,7 @@ def test_suggest_shopping(client, session):
|
|||
"text": '{"suggestions": [{"category": "cleanser", "product_type": "cleanser", "priority": "high", "key_ingredients": [], "target_concerns": [], "why_needed": "reason", "recommended_time": "am", "frequency": "daily"}], "reasoning": "Test shopping"}'
|
||||
},
|
||||
)
|
||||
mock_gemini.return_value = mock_response
|
||||
mock_gemini.return_value = (mock_response, None)
|
||||
|
||||
r = client.post("/products/suggest")
|
||||
assert r.status_code == 200
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue