File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -607,7 +607,7 @@ func TestSanitizeNodeName(t *testing.T) {
607607 want string
608608 }{
609609 {"My GPU Box" , "my-gpu-box" },
610- {"pratik -ec2" , "pratik -ec2" },
610+ {"my -ec2" , "my -ec2" },
611611 {"already-clean" , "already-clean" },
612612 {"UPPER CASE" , "upper-case" },
613613 {"special!@#chars" , "special-chars" },
Original file line number Diff line number Diff line change @@ -123,7 +123,7 @@ func (s AuthHTTPStore) GetOrganizations(options *GetOrganizationsOptions) ([]ent
123123
124124 filteredOrgs := []entity.Organization {}
125125 for _ , o := range orgs {
126- if o .Name == options .Name {
126+ if strings . EqualFold ( o .Name , options .Name ) {
127127 filteredOrgs = append (filteredOrgs , o )
128128 }
129129 }
Original file line number Diff line number Diff line change @@ -50,6 +50,39 @@ func TestGetOrganizations(t *testing.T) {
5050 }
5151}
5252
53+ func TestGetOrganizationsFiltersNameCaseInsensitive (t * testing.T ) {
54+ fs := MakeMockAuthHTTPStore ()
55+ httpmock .ActivateNonDefault (fs .authHTTPClient .restyClient .GetClient ())
56+ defer httpmock .DeactivateAndReset ()
57+
58+ expected := []entity.Organization {{
59+ ID : "1" ,
60+ Name : "TEST" ,
61+ }}
62+ orgs := append (expected , entity.Organization {
63+ ID : "2" ,
64+ Name : "Other" ,
65+ })
66+ res , err := httpmock .NewJsonResponder (200 , orgs )
67+ if ! assert .Nil (t , err ) {
68+ return
69+ }
70+ url := fmt .Sprintf ("%s/%s" , fs .authHTTPClient .restyClient .BaseURL , orgPath )
71+ httpmock .RegisterResponder ("GET" , url , res )
72+
73+ org , err := fs .GetOrganizations (& GetOrganizationsOptions {Name : "test" })
74+ if ! assert .Nil (t , err ) {
75+ return
76+ }
77+ if ! assert .NotNil (t , org ) {
78+ return
79+ }
80+
81+ if ! assert .Equal (t , expected , org ) {
82+ return
83+ }
84+ }
85+
5386func TestCreateOrganization (t * testing.T ) {
5487 fs := MakeMockAuthHTTPStore ()
5588 httpmock .ActivateNonDefault (fs .authHTTPClient .restyClient .GetClient ())
You can’t perform that action at this time.
0 commit comments