@@ -48,7 +48,7 @@ func TestLoginWithNoGalasactlPropertiesFileReturnsError(t *testing.T) {
48
48
mockEnvironment := utils .NewMockEnv ()
49
49
mockGalasaHome , _ := utils .NewGalasaHome (mockFileSystem , mockEnvironment , "" )
50
50
51
- mockResponse := `{"jwt":"blah"}`
51
+ mockResponse := `{"jwt":"blah", "refresh_token":"abc" }`
52
52
server := NewAuthServletMock (t , 200 , mockResponse )
53
53
defer server .Close ()
54
54
@@ -71,7 +71,7 @@ func TestLoginWithBadGalasactlPropertiesFileReturnsError(t *testing.T) {
71
71
galasactlPropertiesFilePath := mockGalasaHome .GetNativeFolderPath () + "/galasactl.properties"
72
72
mockFileSystem .WriteTextFile (galasactlPropertiesFilePath , "here are some bad galasactl.properties contents!" )
73
73
74
- mockResponse := `{"jwt":"blah"}`
74
+ mockResponse := `{"jwt":"blah", "refresh_token":"abc" }`
75
75
server := NewAuthServletMock (t , 200 , mockResponse )
76
76
defer server .Close ()
77
77
@@ -98,7 +98,7 @@ func TestLoginCreatesBearerTokenFileContainingJWT(t *testing.T) {
98
98
tokenPropertyValue := mockRefreshToken + TOKEN_SEPARATOR + mockClientId
99
99
mockFileSystem .WriteTextFile (galasactlPropertiesFilePath , fmt .Sprintf ("GALASA_TOKEN=%s" , tokenPropertyValue ))
100
100
101
- mockResponse := `{"jwt":"blah"}`
101
+ mockResponse := `{"jwt":"blah", "refresh_token":"abc" }`
102
102
server := NewAuthServletMock (t , 200 , mockResponse )
103
103
defer server .Close ()
104
104
@@ -112,9 +112,10 @@ func TestLoginCreatesBearerTokenFileContainingJWT(t *testing.T) {
112
112
bearerTokenFileContents , _ := mockFileSystem .ReadTextFile (bearerTokenFilePath )
113
113
114
114
// Then...
115
+ expectedJson := `{"jwt":"blah"}`
115
116
assert .Nil (t , err , "Should not return an error if the bearer token file has been successfully created" )
116
117
assert .True (t , bearerTokenFileExists , "Bearer token file should exist" )
117
- assert .Equal (t , mockResponse , bearerTokenFileContents )
118
+ assert .Equal (t , expectedJson , bearerTokenFileContents )
118
119
}
119
120
120
121
func TestLoginWithFailedFileWriteReturnsError (t * testing.T ) {
@@ -134,7 +135,7 @@ func TestLoginWithFailedFileWriteReturnsError(t *testing.T) {
134
135
return errors .New ("simulating a failed write operation" )
135
136
}
136
137
137
- mockResponse := `{"jwt":"blah"}`
138
+ mockResponse := `{"jwt":"blah", "refresh_token":"abc" }`
138
139
server := NewAuthServletMock (t , 200 , mockResponse )
139
140
defer server .Close ()
140
141
@@ -185,7 +186,7 @@ func TestLoginWithMissingAuthPropertyReturnsError(t *testing.T) {
185
186
186
187
mockFileSystem .WriteTextFile (galasactlPropertiesFilePath , "unknown.value=blah" )
187
188
188
- mockResponse := `{"jwt":"blah"}`
189
+ mockResponse := `{"jwt":"blah", "refresh_token":"abc" }`
189
190
server := NewAuthServletMock (t , 200 , mockResponse )
190
191
defer server .Close ()
191
192
0 commit comments