(t *testing.T)
| 46 | } |
| 47 | |
| 48 | func TestUsers_Update(t *testing.T) { |
| 49 | skipIfMissingAuth(t) |
| 50 | |
| 51 | u, _, err := client.Users.Get(t.Context(), "") |
| 52 | if err != nil { |
| 53 | t.Fatalf("Users.Get('') returned error: %v", err) |
| 54 | } |
| 55 | |
| 56 | if *u.Login == "" { |
| 57 | t.Error("wanted non-empty values for user.Login") |
| 58 | } |
| 59 | |
| 60 | // save original location |
| 61 | var location string |
| 62 | if u.Location != nil { |
| 63 | location = *u.Location |
| 64 | } |
| 65 | |
| 66 | // update location to test value |
| 67 | testLoc := fmt.Sprintf("test-%v", rand.Int()) |
| 68 | u.Location = &testLoc |
| 69 | |
| 70 | _, _, err = client.Users.Edit(t.Context(), u) |
| 71 | if err != nil { |
| 72 | t.Fatalf("Users.Update returned error: %v", err) |
| 73 | } |
| 74 | |
| 75 | // refetch user and check location value |
| 76 | u, _, err = client.Users.Get(t.Context(), "") |
| 77 | if err != nil { |
| 78 | t.Fatalf("Users.Get('') returned error: %v", err) |
| 79 | } |
| 80 | |
| 81 | if testLoc != *u.Location { |
| 82 | t.Errorf("Users.Get('') has location: %v, want: %v", *u.Location, testLoc) |
| 83 | } |
| 84 | |
| 85 | // set location back to the original value |
| 86 | u.Location = &location |
| 87 | _, _, err = client.Users.Edit(t.Context(), u) |
| 88 | if err != nil { |
| 89 | t.Fatalf("Users.Edit returned error: %v", err) |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | func TestUsers_Emails(t *testing.T) { |
| 94 | skipIfMissingAuth(t) |
nothing calls this directly
no test coverage detected
searching dependent graphs…