MCPcopy Index your code
hub / github.com/actions/actions-runner-controller / TestGetRegistrationToken

Function TestGetRegistrationToken

github/github_test.go:43–72  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

41}
42
43func TestGetRegistrationToken(t *testing.T) {
44 tests := []struct {
45 enterprise string
46 org string
47 repo string
48 token string
49 err bool
50 }{
51 {enterprise: "", org: "", repo: "test/valid", token: fake.RegistrationToken, err: false},
52 {enterprise: "", org: "", repo: "test/invalid", token: "", err: true},
53 {enterprise: "", org: "", repo: "test/error", token: "", err: true},
54 {enterprise: "", org: "test", repo: "", token: fake.RegistrationToken, err: false},
55 {enterprise: "", org: "invalid", repo: "", token: "", err: true},
56 {enterprise: "", org: "error", repo: "", token: "", err: true},
57 {enterprise: "test", org: "", repo: "", token: fake.RegistrationToken, err: false},
58 {enterprise: "invalid", org: "", repo: "", token: "", err: true},
59 {enterprise: "error", org: "", repo: "", token: "", err: true},
60 }
61
62 client := newTestClient()
63 for i, tt := range tests {
64 rt, err := client.GetRegistrationToken(context.Background(), tt.enterprise, tt.org, tt.repo, "test")
65 if !tt.err && err != nil {
66 t.Errorf("[%d] unexpected error: %v", i, err)
67 }
68 if tt.token != rt.GetToken() {
69 t.Errorf("[%d] unexpected token: %v", i, rt.GetToken())
70 }
71 }
72}
73
74func TestListRunners(t *testing.T) {
75 tests := []struct {

Callers

nothing calls this directly

Calls 3

newTestClientFunction · 0.85
GetRegistrationTokenMethod · 0.80
ErrorfMethod · 0.45

Tested by

no test coverage detected