Created
January 21, 2014 19:14
-
-
Save jkyamog/8546327 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def uploadFile(docId: String) = { | |
import scalax.io._ | |
val output = Resource.fromFile("target/test-upload.txt") | |
output.write("hello world")(Codec.UTF8) | |
val testFile = new File("target/test-upload.txt") | |
val file = TemporaryFile(testFile) | |
val data = new MultipartFormData(Map(), | |
List(FilePart("test file", "test-upload.txt", Some("text/plain"), file)), | |
List.empty, | |
List.empty) | |
val insertResult = testController.uploadFile(docId)(FakeRequest(GET, "", FakeHeaders(), data)) | |
contentAsString(insertResult) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment