mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-22 21:42:50 +02:00
Make the config loading testable
This is needed to verify #2309, but it closes a big hole in Hugo's automated tests. The loading of the config is now moved to `hugolib` and the same default settings are now used in production and tests. As Viper now uses Afero as its filesystem, we now can write fairly complete integration tests with ease. See #2309
This commit is contained in:
@@ -29,18 +29,8 @@ func init() {
|
||||
func testCommonResetState() {
|
||||
hugofs.InitMemFs()
|
||||
viper.Reset()
|
||||
viper.Set("ContentDir", "content")
|
||||
viper.Set("DataDir", "data")
|
||||
viper.Set("I18nDir", "i18n")
|
||||
viper.Set("themesDir", "themes")
|
||||
viper.Set("LayoutDir", "layouts")
|
||||
viper.Set("PublishDir", "public")
|
||||
viper.Set("RSSUri", "rss")
|
||||
|
||||
viper.Set("Taxonomies", map[string]interface{}{
|
||||
"tag": "tags",
|
||||
"category": "categories",
|
||||
})
|
||||
viper.SetFs(hugofs.Source())
|
||||
loadDefaultSettings()
|
||||
|
||||
if err := hugofs.Source().Mkdir("content", 0755); err != nil {
|
||||
panic("Content folder creation failed.")
|
||||
|
Reference in New Issue
Block a user