@@ -211,6 +211,31 @@ func Test_initConfiguration_useDefaultOrg(t *testing.T) {
211
211
assert .Equal (t , defaultOrgSlug , actualOrgSlug )
212
212
}
213
213
214
+ func Test_initConfiguration_failDefaultOrgLookup (t * testing.T ) {
215
+ // setup mock
216
+ ctrl := gomock .NewController (t )
217
+ mockApiClient := mocks .NewMockApiClient (ctrl )
218
+
219
+ // mock assertion
220
+ mockApiClient .EXPECT ().Init (gomock .Any (), gomock .Any ()).AnyTimes ()
221
+ mockApiClient .EXPECT ().GetDefaultOrgId ().Return ("" , errors .New ("error" )).AnyTimes ()
222
+
223
+ config := configuration .NewInMemory ()
224
+ engine := workflow .NewWorkFlowEngine (config )
225
+ apiClientFactory := func (url string , client * http.Client ) api.ApiClient {
226
+ return mockApiClient
227
+ }
228
+ initConfiguration (engine , config , & zlog .Logger , apiClientFactory )
229
+
230
+ actualOrgId , orgIdError := config .GetStringWithError (configuration .ORGANIZATION )
231
+ assert .Error (t , orgIdError )
232
+ assert .Empty (t , actualOrgId )
233
+
234
+ actualOrgSlug , slugError := config .GetStringWithError (configuration .ORGANIZATION_SLUG )
235
+ assert .Error (t , slugError )
236
+ assert .Empty (t , actualOrgSlug )
237
+ }
238
+
214
239
func Test_initConfiguration_useDefaultOrgAsFallback (t * testing.T ) {
215
240
orgName := "someOrgName"
216
241
defaultOrgId := "someDefaultOrgId"
0 commit comments