🧪 test: fix unit tests for testserver config
This commit is contained in:
@@ -48,6 +48,8 @@ api:
|
|||||||
auth:
|
auth:
|
||||||
jwt_secret: test-secret
|
jwt_secret: test-secret
|
||||||
admin_master_password: test-admin
|
admin_master_password: test-admin
|
||||||
|
database:
|
||||||
|
name: test_db
|
||||||
`
|
`
|
||||||
|
|
||||||
tempFile := "test-config-test.yaml"
|
tempFile := "test-config-test.yaml"
|
||||||
@@ -70,13 +72,14 @@ auth:
|
|||||||
}
|
}
|
||||||
defer os.Remove(featureConfigDir + "/test-test-config.yaml")
|
defer os.Remove(featureConfigDir + "/test-test-config.yaml")
|
||||||
|
|
||||||
cfg := createTestConfig(7777) // This port should be overridden by config file
|
cfg := createTestConfig(7777) // This port should override config file port
|
||||||
|
|
||||||
// Values from config file should be used
|
// Values from config file should be used, except port which is overridden by parameter
|
||||||
assert.Equal(t, "testhost", cfg.Server.Host)
|
assert.Equal(t, "testhost", cfg.Server.Host)
|
||||||
assert.Equal(t, 1234, cfg.Server.Port, "port from config file should override parameter")
|
assert.Equal(t, 7777, cfg.Server.Port, "parameter port should override config file port")
|
||||||
assert.Equal(t, false, cfg.API.V2Enabled, "v2_enabled from config file should be used")
|
assert.Equal(t, false, cfg.API.V2Enabled, "v2_enabled from config file should be used")
|
||||||
assert.Equal(t, "test-secret", cfg.Auth.JWTSecret, "jwt_secret from config file should be used")
|
assert.Equal(t, "test-secret", cfg.Auth.JWTSecret, "jwt_secret from config file should be used")
|
||||||
assert.Equal(t, "test-admin", cfg.Auth.AdminMasterPassword, "admin_master_password from config file should be used")
|
assert.Equal(t, "test-admin", cfg.Auth.AdminMasterPassword, "admin_master_password from config file should be used")
|
||||||
|
assert.Equal(t, "test_db", cfg.Database.Name, "database name from config file should be used")
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user