mirror of
https://codeberg.org/Codeberg/pages-server.git
synced 2025-04-24 13:56:57 +00:00
fix tests
This commit is contained in:
parent
5ed4ca2500
commit
7b3a09d8ac
2 changed files with 18 additions and 15 deletions
|
@ -74,21 +74,19 @@ func TestReadConfigShouldReturnConfigFromFileWhenConfigArgPresent(t *testing.T)
|
||||||
runApp(
|
runApp(
|
||||||
t,
|
t,
|
||||||
func(ctx *cli.Context) error {
|
func(ctx *cli.Context) error {
|
||||||
content, err := os.ReadFile("assets/test_config.toml")
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
expectedConfig := &Config{}
|
|
||||||
err = toml.Unmarshal(content, expectedConfig)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
cfg, err := ReadConfig(ctx)
|
cfg, err := ReadConfig(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
expectedConfig, err := readTestConfig()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
assert.Equal(t, expectedConfig, cfg)
|
assert.Equal(t, expectedConfig, cfg)
|
||||||
|
|
||||||
return err
|
return nil
|
||||||
},
|
},
|
||||||
[]string{"--config-file", "assets/test_config.toml"},
|
[]string{"--config-file", "assets/test_config.toml"},
|
||||||
)
|
)
|
||||||
|
@ -99,6 +97,9 @@ func TestValuesReadFromConfigFileShouldBeOverwrittenByArgs(t *testing.T) {
|
||||||
t,
|
t,
|
||||||
func(ctx *cli.Context) error {
|
func(ctx *cli.Context) error {
|
||||||
cfg, err := ReadConfig(ctx)
|
cfg, err := ReadConfig(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
MergeConfig(ctx, cfg)
|
MergeConfig(ctx, cfg)
|
||||||
|
|
||||||
|
@ -115,7 +116,7 @@ func TestValuesReadFromConfigFileShouldBeOverwrittenByArgs(t *testing.T) {
|
||||||
|
|
||||||
assert.Equal(t, expectedConfig, cfg)
|
assert.Equal(t, expectedConfig, cfg)
|
||||||
|
|
||||||
return err
|
return nil
|
||||||
},
|
},
|
||||||
[]string{
|
[]string{
|
||||||
"--config-file", "assets/test_config.toml",
|
"--config-file", "assets/test_config.toml",
|
||||||
|
|
|
@ -1,13 +1,15 @@
|
||||||
|
# specify at which log level should be logged
|
||||||
|
# Possible options: trace, debug, info, warn, error
|
||||||
logLevel = 'debug'
|
logLevel = 'debug'
|
||||||
|
|
||||||
[server]
|
[server]
|
||||||
host = '127.0.0.1'
|
host = '127.0.0.1'
|
||||||
port = 443
|
port = 443
|
||||||
httpPort = 80
|
httpPort = 80
|
||||||
httpServerEnabled = false
|
httpServerEnabled = true
|
||||||
mainDomain = ''
|
mainDomain = ''
|
||||||
rawDomain = ''
|
rawDomain = ''
|
||||||
allowedCorsDomains = ['asdf', 'jkl;']
|
allowedCorsDomains = []
|
||||||
blacklistedPaths = []
|
blacklistedPaths = []
|
||||||
|
|
||||||
[gitea]
|
[gitea]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue