@@ -104,6 +104,42 @@ func TestGetActiveOrganization_APIKeyUsesCredentialOrgNameWhenAvailable(t *testi
104104 assert .Equal (t , expected .Name , org .Name )
105105}
106106
107+ func TestGetOrganizationsFiltersNameCaseInsensitive (t * testing.T ) {
108+ fs := MakeMockAuthHTTPStore ()
109+ httpmock .ActivateNonDefault (fs .authHTTPClient .restyClient .GetClient ())
110+ defer httpmock .DeactivateAndReset ()
111+
112+ expected := []entity.Organization {{
113+ ID : "1" ,
114+ Name : "TEST" ,
115+ }}
116+ orgs := []entity.Organization {
117+ expected [0 ],
118+ {
119+ ID : "2" ,
120+ Name : "Other" ,
121+ },
122+ }
123+ res , err := httpmock .NewJsonResponder (200 , orgs )
124+ if ! assert .Nil (t , err ) {
125+ return
126+ }
127+ url := fmt .Sprintf ("%s/%s" , fs .authHTTPClient .restyClient .BaseURL , orgPath )
128+ httpmock .RegisterResponder ("GET" , url , res )
129+
130+ org , err := fs .GetOrganizations (& GetOrganizationsOptions {Name : "test" })
131+ if ! assert .Nil (t , err ) {
132+ return
133+ }
134+ if ! assert .NotNil (t , org ) {
135+ return
136+ }
137+
138+ if ! assert .Equal (t , expected , org ) {
139+ return
140+ }
141+ }
142+
107143func TestCreateOrganization (t * testing.T ) {
108144 fs := MakeMockAuthHTTPStore ()
109145 httpmock .ActivateNonDefault (fs .authHTTPClient .restyClient .GetClient ())
0 commit comments