2023-08-21 00:27:54 +01:00
|
|
|
package serve
|
|
|
|
|
|
|
|
import (
|
2024-08-10 13:28:30 +01:00
|
|
|
"github.com/1f349/bluebell/conf"
|
2023-08-21 00:27:54 +01:00
|
|
|
"github.com/spf13/afero"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
2024-08-10 13:28:30 +01:00
|
|
|
func makeConfig(f afero.Fs) (*conf.Conf, error) {
|
|
|
|
c := conf.New(f)
|
2023-08-21 00:27:54 +01:00
|
|
|
return c, c.Load()
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestName(t *testing.T) {
|
|
|
|
f := afero.NewMemMapFs()
|
|
|
|
h := &Handler{
|
|
|
|
storageFs: f,
|
2024-08-10 13:28:30 +01:00
|
|
|
conf: conf.Testable([]conf.SiteConf{
|
2023-08-21 00:27:54 +01:00
|
|
|
{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,
|
2024-08-10 13:28:30 +01:00
|
|
|
conf: &conf.Conf{},
|
2023-08-21 00:27:54 +01:00
|
|
|
}
|
|
|
|
h.Handle()
|
|
|
|
}
|