@@ -176,6 +176,31 @@ func Test_initConfiguration_useDefaultOrg(t *testing.T) {
176
176
assert .Equal (t , defaultOrgSlug , actualOrgSlug )
177
177
}
178
178
179
+ func Test_initConfiguration_failDefaultOrgLookup (t * testing.T ) {
180
+ // setup mock
181
+ ctrl := gomock .NewController (t )
182
+ mockApiClient := mocks .NewMockApiClient (ctrl )
183
+
184
+ // mock assertion
185
+ mockApiClient .EXPECT ().Init (gomock .Any (), gomock .Any ()).AnyTimes ()
186
+ mockApiClient .EXPECT ().GetDefaultOrgId ().Return ("" , errors .New ("error" )).AnyTimes ()
187
+
188
+ config := configuration .NewInMemory ()
189
+ engine := workflow .NewWorkFlowEngine (config )
190
+ apiClientFactory := func (url string , client * http.Client ) api.ApiClient {
191
+ return mockApiClient
192
+ }
193
+ initConfiguration (engine , config , & zlog .Logger , apiClientFactory )
194
+
195
+ actualOrgId , orgIdError := config .GetStringWithError (configuration .ORGANIZATION )
196
+ assert .Error (t , orgIdError )
197
+ assert .Empty (t , actualOrgId )
198
+
199
+ actualOrgSlug , slugError := config .GetStringWithError (configuration .ORGANIZATION_SLUG )
200
+ assert .Error (t , slugError )
201
+ assert .Empty (t , actualOrgSlug )
202
+ }
203
+
179
204
func Test_initConfiguration_useDefaultOrgAsFallback (t * testing.T ) {
180
205
orgName := "someOrgName"
181
206
defaultOrgId := "someDefaultOrgId"
0 commit comments