Closed Keyruu closed 6 months ago
Like this?
Like this?
Almost, yep - the .testjson
file you've added looks good, but the unit tests aren't reading from it yet. To make them do that, we'll need to add a legacy
-style unit test.
There are a few examples of those in the tests/legacy
directory here: https://github.com/hhursev/recipe-scrapers/tree/4da3a6493cebe91c85378a2307645006b4fb17a9/tests/legacy
I'd recommend test_coopse.py
as one that should be relatively similar to this case, and could be a good option to copy from.
Legacy tests are used for the (relatively infrequent) cases like this where a scraper makes a second HTTP request after loading the initial HTML page. To test those, we configure the expected requests in the test case, and provide test responses.
Okay I added the legacy test. I really hope everything is done now...
@Keyruu thank you, this looks pretty good. Please could you edit the pull request description on GitHub to include the text Resolves #602
? That will automatically close that bugreport if+when this is merged.
I have done everything you asked for. Can this be merged now?
I have done everything you asked for. Can this be merged now?
Soon, yep - there's an improvement related to the Accept-Language
header that I'm thinking about; if I don't get it working soon, then I'll approve+merge without it, but I think we can clean up the code further.
Just added the expected headers in the test.
@Keyruu this has been included and released in v14.56.0
(and also the pre-release v15.0.0-rc3
) of recipe-scrapers
on PyPi.
Awesome thanks.
I'm not a python pro but I hope this code is good enough. This fixes the Monsieur Cuisine scraper for the new website. I use their API as mentioned in #602. Mind the Device-Type header, without this header the API won't return names for the ingredients for whatever reasons. Resolves #602