(t *testing.T)
| 219 | } |
| 220 | |
| 221 | func prepareTestContext(t *testing.T) *TestContext { |
| 222 | id := strconv.FormatInt(time.Now().UnixNano()/1000000, 10) |
| 223 | |
| 224 | fullRepo, ok := os.LookupEnv(EnvRepo) |
| 225 | if !ok || fullRepo == "" { |
| 226 | t.Skipf("%s must be set in the environment", EnvRepo) |
| 227 | } |
| 228 | token, ok := os.LookupEnv(EnvToken) |
| 229 | if !ok || token == "" { |
| 230 | t.Skipf("%s must be set in the environment", EnvToken) |
| 231 | } |
| 232 | |
| 233 | repo, err := ParseRepository(fullRepo) |
| 234 | if err != nil { |
| 235 | t.Fatalf("Invalid %s value: %v", EnvRepo, err) |
| 236 | } |
| 237 | |
| 238 | ctx := context.Background() |
| 239 | httpClient := internal.NewTokenClient(token) |
| 240 | |
| 241 | client, err := github.NewClient(github.WithHTTPClient(httpClient)) |
| 242 | if err != nil { |
| 243 | t.Fatalf("Error creating GitHub client: %v", err) |
| 244 | } |
| 245 | |
| 246 | tctx := TestContext{ |
| 247 | Context: ctx, |
| 248 | ID: id, |
| 249 | Repo: repo, |
| 250 | Client: client, |
| 251 | V4Client: githubv4.NewClient(httpClient), |
| 252 | } |
| 253 | return &tctx |
| 254 | } |
| 255 | |
| 256 | func createBranch(t *testing.T, tctx *TestContext) { |
| 257 | root := filepath.Join("testdata", "base") + string(filepath.Separator) |
no test coverage detected