testserver: auto-create directories when importing a file

This commit is contained in:
Denis Bilenko 2025-02-10 16:33:32 +01:00
parent 7cf1f5c635
commit fe96f80de1
1 changed files with 12 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"sort"
"strconv"
"strings"
@ -81,6 +82,17 @@ func (s *FakeWorkspace) WorkspaceFilesImportFile(path string, body []byte) {
path = "/" + path
}
s.files[path] = body
for {
p = path.Dir(p)
if p == "" || p == "/" {
break
}
s.directories[p] = true
}
return "{}", http.StatusOK
}
func (s *FakeWorkspace) JobsCreate(request jobs.CreateJob) Response {