CopyFixture writes the content of the given fixture to the filename inside the dnote dir
(t *testing.T, ctx context.DnoteCtx, fixturePath string, filename string)
| 68 | |
| 69 | // CopyFixture writes the content of the given fixture to the filename inside the dnote dir |
| 70 | func CopyFixture(t *testing.T, ctx context.DnoteCtx, fixturePath string, filename string) { |
| 71 | fp, err := filepath.Abs(fixturePath) |
| 72 | if err != nil { |
| 73 | t.Fatal(errors.Wrap(err, "getting the absolute path for fixture")) |
| 74 | } |
| 75 | |
| 76 | dp, err := filepath.Abs(filepath.Join(ctx.Paths.LegacyDnote, filename)) |
| 77 | if err != nil { |
| 78 | t.Fatal(errors.Wrap(err, "getting the absolute path dnote dir")) |
| 79 | } |
| 80 | |
| 81 | err = utils.CopyFile(fp, dp) |
| 82 | if err != nil { |
| 83 | t.Fatal(errors.Wrap(err, "copying the file")) |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | // WriteFile writes a file with the given content and filename inside the dnote dir |
| 88 | func WriteFile(ctx context.DnoteCtx, content []byte, filename string) { |