(t *testing.T)
| 41 | } |
| 42 | |
| 43 | func 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 | |
| 74 | func TestListRunners(t *testing.T) { |
| 75 | tests := []struct { |
nothing calls this directly
no test coverage detected