MCPcopy Create free account
hub / github.com/github/gh-aw / TestEnsureCopilotSetupStepsFilePermissions

Function TestEnsureCopilotSetupStepsFilePermissions

pkg/cli/copilot_setup_test.go:296–328  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

294}
295
296func TestEnsureCopilotSetupStepsFilePermissions(t *testing.T) {
297 tmpDir := testutil.TempDir(t, "test-*")
298
299 originalDir, err := os.Getwd()
300 if err != nil {
301 t.Fatalf("Failed to get current directory: %v", err)
302 }
303 defer func() {
304 _ = os.Chdir(originalDir)
305 }()
306
307 if err := os.Chdir(tmpDir); err != nil {
308 t.Fatalf("Failed to change to temp directory: %v", err)
309 }
310
311 err = ensureCopilotSetupSteps(context.Background(), false, workflow.ActionModeDev, "dev")
312 if err != nil {
313 t.Fatalf("ensureCopilotSetupSteps(context.Background()) failed: %v", err)
314 }
315
316 // Check file permissions
317 setupStepsPath := filepath.Join(".github", "workflows", "copilot-setup-steps.yml")
318 info, err := os.Stat(setupStepsPath)
319 if err != nil {
320 t.Fatalf("Failed to stat copilot-setup-steps.yml: %v", err)
321 }
322
323 // Verify file is readable and writable
324 mode := info.Mode()
325 if mode.Perm()&0600 != 0600 {
326 t.Errorf("Expected file to have at least 0600 permissions, got %o", mode.Perm())
327 }
328}
329
330func TestCopilotWorkflowStepStructure(t *testing.T) {
331 t.Parallel()

Callers

nothing calls this directly

Calls 4

TempDirFunction · 0.92
ensureCopilotSetupStepsFunction · 0.85
BackgroundMethod · 0.80
ErrorfMethod · 0.45

Tested by

no test coverage detected