Self hosted FLOSS fitness/workout, nutrition and weight tracker
Fix test_search_new_code mock returning MagicMock instead of None
Roland Geider28118d2486fa
diff --git a/wger/nutrition/tests/test_ingredient.py b/wger/nutrition/tests/test_ingredient.pyindex e38dce29a..8687723c6 100644--- a/wger/nutrition/tests/test_ingredient.py+++ b/wger/nutrition/tests/test_ingredient.py@@ -718,6 +718,11 @@ class IngredientApiCodeSearch(BaseTestCase, ApiBaseTestCase):"""Test that when a code isn't present, it will be fetched"""+ # The barcode filter calls queryset.filter(pk=ingredient.pk) when OFF+ # returns something, which fails on the default MagicMock. Simulate the+ # "not found upstream" branch by returning None.+ mock_fetch_from_off.return_value = None+response = self.client.get(self.url + '?code=122333444455555666666')mock_fetch_from_off.assert_called_with('122333444455555666666')