-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding operations to get cloud foundry users via v3 api
- Loading branch information
Caleb Washburn
committed
Aug 3, 2022
1 parent
61577e4
commit 5e81c20
Showing
5 changed files
with
228 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package cfclient | ||
|
||
import ( | ||
"net/http" | ||
"net/url" | ||
"testing" | ||
|
||
. "github.com/smartystreets/goconvey/convey" | ||
) | ||
|
||
func TestListV3UserByQuery(t *testing.T) { | ||
Convey("List V3 Users by Query", t, func() { | ||
mocks := []MockRoute{ | ||
{"GET", "/v3/users", []string{listV3UsersPayload}, "", http.StatusOK, "", nil}, | ||
{"GET", "/v3/userspage2", []string{listV3UsersPayloadPage2}, "", http.StatusOK, "page=2&per_page=2", nil}, | ||
} | ||
setupMultiple(mocks, t) | ||
defer teardown() | ||
|
||
c := &Config{ApiAddress: server.URL, Token: "foobar"} | ||
client, err := NewClient(c) | ||
So(err, ShouldBeNil) | ||
|
||
query := url.Values{} | ||
users, err := client.ListV3UsersByQuery(query) | ||
So(err, ShouldBeNil) | ||
So(users, ShouldHaveLength, 3) | ||
|
||
So(users[0].Username, ShouldEqual, "smoke_tests") | ||
So(users[1].Username, ShouldEqual, "test1") | ||
So(users[2].Username, ShouldEqual, "test2") | ||
}) | ||
|
||
} |