Add custom recipe creation, editing and deletion API#179
Conversation
…ettingsXsettings)
miaucl
left a comment
There was a problem hiding this comment.
Thx for helping out!
Please keep your SKILL.md in your own fork.
Also, I dont see any unit test coverage nor extension on the smoke tests. For a volatile library as this where we don't know when the API changes such things are essential.
…moke tests - Remove SKILL.md from repo (keep in fork only per maintainer request) - Add comprehensive unit tests in tests/test_edge_cases.py: * Config & localization tests (12 variants) * Auth edge cases (token expiry, invalid refresh) * Network resilience (5xx errors, timeouts) * API volatility protection (missing/extra fields) * Recipe CRUD with structured instructions * Calendar & shopping list edge cases - Extend smoke tests in smoke_test/test_3_extended.py: * Full recipe lifecycle tests * Multi-day calendar operations * Complete shopping list workflow * Collection management (custom + managed) * Error handling scenarios Total: 2,050+ lines of new test coverage
|
Hi @miaucl, Thank you for creating and maintaining this API it's been incredibly useful! I've addressed all the feedback: Removed SKILL.md |
miaucl
left a comment
There was a problem hiding this comment.
Looks better :)
Please structure the unit tests and smoke tests better and "test_3_extended" is not a good name. There are some custom recipe tests in the test_edge_case which does not fit as well.
| @@ -1,5 +1,7 @@ | |||
| """Cookidoo API types.""" | |||
|
|
|||
| from __future__ import annotations | |||
There was a problem hiding this comment.
is this needed? until know, I had the type def without the need for future
There was a problem hiding this comment.
You're right, it's not needed! I reordered the classes so CookidooStepSettings and CookidooInstruction are defined before CookidooCreateCustomRecipe and CookidooEditCustomRecipe, eliminating the forward reference. Removed the __future__ import.
| active_time=30*60, # 30 minutes active prep | ||
| unit_text="portion", # IMPORTANT: Must be exactly "portion" | ||
| tools=["TM7", "TM6"], # Works with both TM7 and TM6 models | ||
| ingredients=[ |
There was a problem hiding this comment.
possible to have the example in english? More people will be able to read it ;)
| assert result1.access_token == "test_token" | ||
|
|
||
|
|
||
| class TestRecipeOperations: |
There was a problem hiding this comment.
these are not really edge cases, rather just unit tests for custom recipes, no?
|
The file test_2_methods.py is getting pretty large, but all smoke tests should be in there for now. |
|
also, please run the linter and formatter before pushing, see readme for instrcutions |
miaucl
left a comment
There was a problem hiding this comment.
Guess there is still some work to do in the testing :)
- Remove from __future__ import annotations from types.py - Translate example recipe from Greek to English - Rename test_edge_cases.py to test_custom_recipes.py - Remove PR_RESPONSE.md - Consolidate smoke tests into test_2_methods.py, remove test_3_extended.py - Add examples/ to ruff per-file-ignores for T20 - Fix formatting and lint issues (ruff)
|
@miaucl , is there a burner account to test hardware annotations on recipe creation? I pulled some rest transactions from my account and rev-engineered. Would be great to smoke test. - this would be another workstream |
- Extract _format_instructions helper in helpers.py - Move custom recipe unit tests into test_cookidoo.py with proper mocks - Remove standalone test_custom_recipes.py and examples/create_recipe.py - Fix type annotations in types.py
Move CookidooStepSettings and CookidooInstruction before CookidooCreateCustomRecipe and CookidooEditCustomRecipe to eliminate forward references, removing the need for __future__ annotations.
Send time, temperature, and speed as separate fields in the instruction JSON payload so the Cookidoo app can render them as formatted settings (like the mobile app does) instead of plain text.
What do you mean with burner account? I already have set up accounts for different countries for the smoke tests. You can create easily test accounts for yourself if you need to test something. (Just need an new email ^^) Or did I misunderstand you? |
This PR adds the ability to create custom recipes from scratch (not just copy existing ones).
New Features
Custom Recipe API
create_custom_recipe()- Create new recipes from scratch with full detailsedit_custom_recipe()- Edit existing custom recipesget_custom_recipes()- List all custom recipesremove_custom_recipe()- Delete custom recipesStructured Step Settings
CookidooInstructionwithCookidooStepSettings(time, temperature, speed)Usage Example
Technical Details
{"type": "INGREDIENT", "text": "..."}{"type": "STEP", "text": "..."}unit_textmust be exactly"portion"Tests
tests/test_cookidoo.pywith proper mocked responsessmoke_test/test_2_methods.pyAll existing functionality remains unchanged. This only adds new capabilities.