func TestFileUploadHandler(t *testing.T) {
	assert := audit.NewTestingAssertion(t, true)
	data := "Been there, done that!"
	// Setup the file upload processor.
	processor := func(job rest.Job, header *multipart.FileHeader, file multipart.File) error {
		assert.Equal(header.Filename, "test.txt")
		scanner := bufio.NewScanner(file)
		assert.True(scanner.Scan())
		text := scanner.Text()
		assert.Equal(text, data)
		return nil
	}
	// Setup the test server.
	mux := newMultiplexer(assert)
	ts := restaudit.StartServer(mux, assert)
	defer ts.Close()
	err := mux.Register("test", "files", handlers.NewFileUploadHandler("files", processor))
	assert.Nil(err)
	// Perform test requests.
	ts.DoUpload("/test/files", "testfile", "test.txt", data)
}
// TestFileUploadHandler tests the uploading of files.
TestFileUploadHandler tests the uploading of files.
// TestFileUploadHandler tests the uploading of files .
func TestFileUploadHandler(t *testing.T) {
	assert := audit.NewTestingAssertion(t, true)
	data := "Been there, done that!"
	processor := func(job rest.Job, header *multipart.FileHeader, file multipart.File) error {
		assert.Equal(header.Filename, "test.txt")
		scanner := bufio.NewScanner(file)
		assert.True(scanner.Scan())
		text := scanner.Text()
		assert.Equal(text, data)
		return nil
	}
	mux := newMultiplexer(assert)
	ts := restaudit.StartServer(mux, assert)
	defer ts.Close()
	err := mux.Register("test", "files", handlers.NewFileUploadHandler("files", processor))
	assert.Nil(err)
	ts.DoUpload("/test/files", "testfile", "test.txt", data)
}
func TestFileUploadHandler ( t * testing . T ) { assert := audit . NewTestingAssertion ( t , true ) data := " " processor := func ( job rest . Job , header * multipart . FileHeader , file multipart . File ) error { assert . Equal ( header . Filename , " " ) scanner := bufio . NewScanner ( file ) assert . True ( scanner . Scan ( ) ) text := scanner . Text ( ) assert . Equal ( text , data ) return nil } mux := newMultiplexer ( assert ) ts := restaudit . StartServer ( mux , assert ) defer ts . Close ( ) err := mux . Register ( " " , " " , handlers . NewFileUploadHandler ( " " , processor ) ) assert . Nil ( err ) ts . DoUpload ( " " , " " , " " , data ) }
TestFileUploadHandler tests the uploading of files.
TestFileUploadHandler tests the uploading of files .
// Setup the file upload processor. // Setup the test server. // Perform test requests.