Don't give rate limit delay when project is not found

This commit is contained in:
simon987
2019-03-10 09:54:04 -04:00
parent 15a3e66b70
commit d62c70e1be
4 changed files with 40 additions and 5 deletions

View File

@@ -899,6 +899,26 @@ func TestTaskChainCausesConflict(t *testing.T) {
}
}
func TestTaskAssignInvalidDoesntGiveRateLimit(t *testing.T) {
task := getTaskFromProject(13247, testWorker)
if task.RateLimitDelay != 0 {
t.Error()
}
}
func TestTaskSubmitInvalidDoesntGiveRateLimit(t *testing.T) {
resp := createTask(api.SubmitTaskRequest{
Recipe: " ",
Project: 133453,
}, testWorker)
if resp.RateLimitDelay != 0 {
t.Error()
}
}
func createTask(request api.SubmitTaskRequest, worker *storage.Worker) (ar api.JsonResponse) {
r := Post("/task/submit", request, worker, nil)
UnmarshalResponse(r, &ar)