44 lines
849 B
Go
44 lines
849 B
Go
package http
|
|
|
|
import (
|
|
"log/slog"
|
|
|
|
"git.clan.lol/clan/data-mesher/pkg/config"
|
|
"git.clan.lol/clan/data-mesher/pkg/state"
|
|
"github.com/labstack/echo/v4"
|
|
)
|
|
|
|
// NewTestServer creates a Server for testing purposes.
|
|
func NewTestServer(
|
|
logger *slog.Logger,
|
|
cfg *config.Config,
|
|
files *state.Files,
|
|
e *echo.Echo,
|
|
) *Server {
|
|
return &Server{
|
|
cfg: cfg,
|
|
files: files,
|
|
echo: e,
|
|
}
|
|
}
|
|
|
|
// Echo returns the echo instance for testing.
|
|
func (s *Server) Echo() *echo.Echo {
|
|
return s.echo
|
|
}
|
|
|
|
// PutFile exposes putFile for testing.
|
|
func (s *Server) PutFile(c echo.Context) error {
|
|
return s.putFile(c)
|
|
}
|
|
|
|
// ListFiles exposes listFiles for testing.
|
|
func (s *Server) ListFiles(c echo.Context) error {
|
|
return s.listFiles(c)
|
|
}
|
|
|
|
// DeleteFile exposes deleteFile for testing.
|
|
func (s *Server) DeleteFile(c echo.Context) error {
|
|
return s.deleteFile(c)
|
|
}
|