2023-08-21 00:27:54 +01:00
|
|
|
package serve
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/1f349/site-hosting/config"
|
|
|
|
"github.com/spf13/afero"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func makeConfig(f afero.Fs) (*config.Config, error) {
|
|
|
|
c := config.New(f)
|
|
|
|
return c, c.Load()
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestName(t *testing.T) {
|
|
|
|
f := afero.NewMemMapFs()
|
|
|
|
h := &Handler{
|
|
|
|
storageFs: f,
|
|
|
|
conf: config.Testable([]config.SiteConf{
|
|
|
|
{Domain: "example.com", Token: "abcd1234"},
|
|
|
|
}),
|
|
|
|
}
|
|
|
|
h.findSiteBranchSubdomain("example-com-test")
|
2023-12-05 23:10:26 +00:00
|
|
|
site, branch := h.findSiteBranch("example-com_test")
|
2023-08-21 00:27:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestHandler_Handle(t *testing.T) {
|
|
|
|
f := afero.NewMemMapFs()
|
|
|
|
h := &Handler{
|
|
|
|
storageFs: f,
|
|
|
|
conf: &config.Config{},
|
|
|
|
}
|
|
|
|
h.Handle()
|
|
|
|
}
|