Reputation: 706
I wrote a controller that tests if an image is valid, as in does it actually contain an image or is just a 1000 pixel square of nothing. It takes an image through a URL. It works fine but I can't figure out how to write this unit test for the life of me. How would I mock a URL with image data? I have been digging around and can't find an answer.
Upvotes: 0
Views: 222
Reputation: 4572
A local file can be represented by a URL using the scheme file://
.So just save a test image locally accessible to your unit test
ref: http://en.wikipedia.org/wiki/File_URI_scheme
Upvotes: 1