Reorganize set_authinfo_test

Minor refactor to resolve warning of Goland IDE code
inspection "Unresolved reference 'run'."

Change-Id: Ic8bbde3ca63903910b91420f3d3178ed1539ce8c
Signed-off-by: Alexander Hughes <Alexander.Hughes@pm.me>
This commit is contained in:
Alexander Hughes 2020-03-05 08:28:31 -05:00
parent 7f06e556a4
commit fd096c099d

View File

@ -86,6 +86,25 @@ func initInputConfig(t *testing.T) (given *config.Config, cleanup func(*testing.
return given, givenCleanup
}
func (test setAuthInfoTest) run(t *testing.T) {
settings := &environment.AirshipCTLSettings{}
settings.SetConfig(test.inputConfig)
test.cmdTest.Cmd = NewCmdConfigSetAuthInfo(settings)
testutil.RunTest(t, test.cmdTest)
afterRunConf := settings.Config()
// Find the AuthInfo Created or Modified
afterRunAuthInfo, err := afterRunConf.GetAuthInfo(test.userName)
require.NoError(t, err)
require.NotNil(t, afterRunAuthInfo)
afterKauthinfo := afterRunAuthInfo.KubeAuthInfo()
require.NotNil(t, afterKauthinfo)
assert.EqualValues(t, afterKauthinfo.Username, testUsername)
assert.EqualValues(t, afterKauthinfo.Password, test.userPassword)
}
func TestSetAuthInfo(t *testing.T) {
given, cleanup := config.InitConfig(t)
defer cleanup(t)
@ -135,22 +154,3 @@ func TestSetAuthInfo(t *testing.T) {
test.run(t)
}
}
func (test setAuthInfoTest) run(t *testing.T) {
settings := &environment.AirshipCTLSettings{}
settings.SetConfig(test.inputConfig)
test.cmdTest.Cmd = NewCmdConfigSetAuthInfo(settings)
testutil.RunTest(t, test.cmdTest)
afterRunConf := settings.Config()
// Find the AuthInfo Created or Modified
afterRunAuthInfo, err := afterRunConf.GetAuthInfo(test.userName)
require.NoError(t, err)
require.NotNil(t, afterRunAuthInfo)
afterKauthinfo := afterRunAuthInfo.KubeAuthInfo()
require.NotNil(t, afterKauthinfo)
assert.EqualValues(t, afterKauthinfo.Username, testUsername)
assert.EqualValues(t, afterKauthinfo.Password, test.userPassword)
}