From 3da102d464b7d49ad9be566635716ac947fb3f99 Mon Sep 17 00:00:00 2001 From: Albert Nigmatzianov Date: Sun, 30 Jul 2017 17:18:17 +0200 Subject: [PATCH] cmd: Fix golden tests if user has config at $HOME Fix #505 --- cobra/cmd/add_test.go | 6 +++++- cobra/cmd/init_test.go | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/cobra/cmd/add_test.go b/cobra/cmd/add_test.go index 8cda321e..0c46bc58 100644 --- a/cobra/cmd/add_test.go +++ b/cobra/cmd/add_test.go @@ -23,7 +23,11 @@ func TestGoldenAddCmd(t *testing.T) { initializeProject(project) defer os.RemoveAll(project.AbsPath()) - viper.Set("year", 2017) // For reproducible builds. + viper.Set("author", "NAME HERE ") + viper.Set("license", "apache") + viper.Set("year", 2017) + defer viper.Set("author", nil) + defer viper.Set("license", nil) defer viper.Set("year", nil) // Then add the "test" command. diff --git a/cobra/cmd/init_test.go b/cobra/cmd/init_test.go index 115f5d2f..40eb4038 100644 --- a/cobra/cmd/init_test.go +++ b/cobra/cmd/init_test.go @@ -19,7 +19,11 @@ func TestGoldenInitCmd(t *testing.T) { project := NewProject(projectName) defer os.RemoveAll(project.AbsPath()) - viper.Set("year", 2017) // For reproducible builds. + viper.Set("author", "NAME HERE ") + viper.Set("license", "apache") + viper.Set("year", 2017) + defer viper.Set("author", nil) + defer viper.Set("license", nil) defer viper.Set("year", nil) os.Args = []string{"cobra", "init", projectName}