forked from rosa/hakurei
internal/rosa: mirror response write methods
For the fs.FS implementation and static publishing. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"crypto/ed25519"
|
||||
"io/fs"
|
||||
"log"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
"testing"
|
||||
@@ -52,14 +53,16 @@ func TestMirror(t *testing.T) {
|
||||
}
|
||||
wantChecksums := pkg.Encode(wantChecksum)
|
||||
|
||||
server := httptest.NewServer(rosa.NewMirror(msg, fstest.MapFS{
|
||||
var mux http.ServeMux
|
||||
rosa.NewMirror(msg, fstest.MapFS{
|
||||
"identifier/" + ids: {Mode: fs.ModeSymlink | 0777, Data: []byte("../checksum/" + wantChecksums)},
|
||||
"checksum/" + wantChecksums: {Mode: os.ModeDir | 0500},
|
||||
}, priv))
|
||||
}, priv).Register(&mux)
|
||||
server := httptest.NewServer(&mux)
|
||||
t.Cleanup(server.Close)
|
||||
|
||||
var extern pkg.External
|
||||
extern, err = rosa.NewRemote("http://example.com:80", pub, server.Client())
|
||||
extern, err = rosa.NewRemote(server.Client(), "http://example.com:80", pub)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user