in reply to Re^6: Testing with Test::Mock::HTTP::Tiny
in thread Testing with Test::Mock::HTTP::Tiny
I don't know what goes on in WWW::Crawl. You have the added complication that you change the domain name. I would start from the Mock module, add debugging messages to see what urls/domains it has in store. What I understand you did is: 1) get data from domain A. 2) save it to Mock module with different domain B (how???). 3) try to retrieve mock data by using domain B OR fetch fresh. 4) croak. Well, it looks like step 3 fails: url is neither in Mock module nor out there in the web to be fetched fresh. The latter is true because it has a 'fake' domain. So not in store or domain change failed.
Oh, in all my tests above I never changed the domain.
1min edit: can it be that HTTP::Tiny within WWW::Crawl was not affected by Mock (which adds a callback for 'request'). In this case, if WWW::Crawl is yours add an option to have an $http passed on it rather than creating one fresh from inside the module. Long shot but I have no idea how this kind of inter-package interaction works.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^8: Testing with Test::Mock::HTTP::Tiny
by Bod (Parson) on Sep 29, 2023 at 20:05 UTC | |
by afoken (Chancellor) on Sep 29, 2023 at 21:57 UTC | |
by Bod (Parson) on Sep 30, 2023 at 00:05 UTC | |
|
Re^8: Testing with Test::Mock::HTTP::Tiny
by Bod (Parson) on Sep 29, 2023 at 21:32 UTC |