working commit

This commit is contained in:
2026-01-26 18:36:30 +02:00
parent 15e4e893b1
commit 6db319088e
19 changed files with 621 additions and 95 deletions
+20 -16
View File
@@ -9,13 +9,12 @@ import (
"mstore/app/router"
"mstore/app/server"
"mstore/app/service"
//"mstore/pkg/client"
"github.com/stretchr/testify/require"
)
func TestFileExists(t *testing.T) {
func MakeServer(t *testing.T) *server.Server {
var err error
srv, err := server.NewServer()
require.NoError(t, err)
@@ -26,6 +25,15 @@ func TestFileExists(t *testing.T) {
err = srv.Build()
require.NoError(t, err)
return srv
}
func TestFileExists(t *testing.T) {
var err error
srv := MakeServer(t)
require.NotNil(t, srv)
reqPath := `/v3/api/file/foo/bare`
routePath := `/v3/api/file/{filepath}`
@@ -44,28 +52,24 @@ func TestFileExists(t *testing.T) {
fmt.Printf("Response code: %d\n", recorder.Code)
//bodyReader := recorder.Body
//bodyBytes, err := io.ReadAll(bodyReader)
bodyReader := recorder.Body
bodyBytes, err := io.ReadAll(bodyReader)
//fmt.Printf("Response body: %s\n", string(bodyBytes))
fmt.Printf("Response body: %s\n", string(bodyBytes))
}
func xxxTestServiceHello(t *testing.T) {
func TestServiceHello(t *testing.T) {
var err error
srv, err := server.NewServer()
require.NoError(t, err)
err = srv.Configure()
require.NoError(t, err)
srv := MakeServer(t)
require.NotNil(t, srv)
err = srv.Build()
require.NoError(t, err)
reqPath := service.ServiceHelloPath
reqPath := "/service/hello"
routePath := "/service/hello"
rout := router.NewRouter()
hand := srv.Handler()
rout.Get(reqPath, hand.SendHello)
rout.Get(routePath, hand.SendHello)
request, err := http.NewRequest("GET", reqPath, nil)
require.NoError(t, err)