summaryrefslogtreecommitdiff
path: root/kitchen/tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'kitchen/tests.py')
-rw-r--r--kitchen/tests.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/kitchen/tests.py b/kitchen/tests.py
index 9ce9098..f3f68e2 100644
--- a/kitchen/tests.py
+++ b/kitchen/tests.py
@@ -224,6 +224,19 @@ class BulkAddApiTests(_ApiTestCase):
self.assertEqual(rows.count(), 1)
self.assertEqual(rows.first().state, "in")
+ def test_tolerates_null_unit_and_quantity(self):
+ # An MCP client may send unit/quantity as null for unknown items.
+ r = self.client.post(
+ "/api/bulk-pantry-add/",
+ {"items": [{"ingredient_name": "pork mince", "location": "fridge",
+ "unit": None, "quantity": None}]},
+ format="json",
+ )
+ self.assertEqual(r.status_code, 201)
+ self.assertTrue(
+ PantryItem.objects.filter(ingredient__name="pork mince", location="fridge").exists()
+ )
+
class WhatCanICookApiTests(_ApiTestCase):
def setUp(self):