MCPcopy Create free account
hub / github.com/dinofizz/diskplayer / TestRecordWriteError

Function TestRecordWriteError

recorder_test.go:64–86  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

62}
63
64func TestRecordWriteError(t *testing.T) {
65 const p = "./test_recorder_path.contents"
66 viper.Set("recorder.file_path", p)
67 if _, err := os.Stat(p); os.IsExist(err) {
68 err := os.Remove(p)
69 if err != nil {
70 t.Fatalf("Remove %s: %v", p, err)
71 }
72 }
73
74 shmorp := []byte("shmorp")
75 err := ioutil.WriteFile(p, shmorp, 0444)
76 if err != nil {
77 t.Fatalf("WriteFile %s: %v", p, err)
78 }
79 defer func() {
80 err := os.Remove(p)
81 assert.NoErrorf(t, err, "Failed to remove temporary test file: %s", p)
82 }()
83 err = Record(recordTests[0].in, p)
84 assert.Error(t, err)
85 assert.Equal(t, "open ./test_recorder_path.contents: permission denied", err.Error())
86}

Callers

nothing calls this directly

Calls 1

RecordFunction · 0.85

Tested by

no test coverage detected