Hi! I faced an issue during cover my application with tests.
Prerequisites:
* I'm using docker-compose to run application and tests locally.
* I have main app and minion tasks.
One of app's features is to deal with goods and associated images.
Usually I read goods list and its metadata (including image urls) from
external source (like rss feed).
Also app has (openapi) rest route, and I can post good object there to
create entries in database and so on.
And I want to test this rest route.
Is good created? Is associated images succecfully parsed and saved? App
uses minions for this tasks.
So in my test I want to post good object to rest endpoint, than perform
minion jobs and than test that good entries in (test) database and
images are ok.
Now the problem:
minion task parses original image and create several cropped and resized
versions. To get original image task uses Mojo::UserAgent.
In my test I put images locally, save host_port part of Test::Mojo
server url into env variable and later in minion task generate links to
image from good metadata path and this env var. I expected, that
Mojo::UserAgent can download image from Test::Mojo server, but it fails.
Looks like it's bad idea and Test::Mojo is not working that way.
Probably I can do something similar to what i want with
Test::Fake::HTTPD. But maybe there is a chance to do it in mojo way?
Any help would be appreciated.
--
Best Regards, Ilya Rassadin
--
You received this message because you are subscribed to the Google Groups
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.