I'm working on play2.1 writing a test for a post controller that uses multipart forms using the route function.
route(
FakeRequest(POST,
postControllerRoute().url,
FakeHeaders(Seq(HeaderNames.CONTENT_TYPE -> Seq("multipart/form-data"))),
body = body
).withAuthToken.withAdmin(adminId))
I've found that for this code to work I need to define a writeable of this type Writeable[MultipartFormData[TemporaryFile]] since my body variable is of type MultipartFormData[TemporaryFile]. I'm not sure how to serialize a multipart request or if this is even the right approach. Any suggestions?
Edited
Answer: Skip the router and use the controller directly like in the docs: http://www.playframework.com/documentation/2.1.0/ScalaFunctionalTest