MCPcopy Index your code
hub / github.com/google/go-github / TestUsers_Get

Function TestUsers_Get

test/integration/users_test.go:18–46  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

16)
17
18func TestUsers_Get(t *testing.T) {
19 // list all users
20 users, _, err := client.Users.ListAll(t.Context(), nil)
21 if err != nil {
22 t.Fatalf("Users.ListAll returned error: %v", err)
23 }
24
25 if len(users) == 0 {
26 t.Error("Users.ListAll returned no users")
27 }
28
29 // mojombo is user #1
30 if want := "mojombo"; want != *users[0].Login {
31 t.Errorf("user[0].Login was %q, wanted %q", *users[0].Login, want)
32 }
33
34 // get individual user
35 u, _, err := client.Users.Get(t.Context(), "octocat")
36 if err != nil {
37 t.Fatalf("Users.Get('octocat') returned error: %v", err)
38 }
39
40 if want := "octocat"; want != *u.Login {
41 t.Errorf("user.Login was %q, wanted %q", *u.Login, want)
42 }
43 if want := "The Octocat"; want != *u.Name {
44 t.Errorf("user.Name was %q, wanted %q", *u.Name, want)
45 }
46}
47
48func TestUsers_Update(t *testing.T) {
49 skipIfMissingAuth(t)

Callers

nothing calls this directly

Calls 3

ListAllMethod · 0.45
ErrorMethod · 0.45
GetMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…