fix tests

This commit is contained in:
crapStone 2023-11-19 23:56:56 +01:00
parent 5ed4ca2500
commit 7b3a09d8ac
No known key found for this signature in database
GPG Key ID: D74B82E7CDD863FE
2 changed files with 18 additions and 15 deletions

View File

@ -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",

View File

@ -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]