func TestNewJob(t *testing.T) {
	mock := upload.NewMock()
	InjectUploader(mock)
	store := storage.NewJobStore()
	InjectJobstore(&store)

	err := MakeGrayFile(1000, 1000, "/tmp/upload.png")
	if err != nil {
		t.Error("Error in creating test file")
	}
	defer os.Remove("/tmp/upload.png")

	req := JobRequest{
		"/tmp/upload.png",
		image.Rect(200, 200, 200, 200),
		0, 150,
		"test.png",
	}

	jobid := NewJob(req)
	if jobid != 0 {
		t.Errorf("Expected jobid to be %d but was %d\n", 0, jobid)
	}

}
func TestAllWithSetup(t *testing.T) {
	go StartWebServer(portnum)
	time.Sleep(50 * time.Millisecond)
	mock = upload.NewMock()
	core.InjectUploader(mock)
	store := storage.NewJobStore()
	core.InjectJobstore(&store)
	core.InjectStorageReporter(&store)
	err := MakeGrayFile(1000, 1000, "/tmp/upload.gif")
	if err != nil {
		t.Error("Error in creating test file")
	}
	defer os.Remove("/tmp/upload.gif")

	testStartWebserver(t)
	testStatusOfBadJob(t)
	testRequestingNewJob(t)
	testStatusOfExistingJob(t)
	testStatsReturnsJSON(t)
}