MCPcopy
hub / github.com/hashicorp/go-getter / TestGetFile_archive

Function TestGetFile_archive

get_test.go:333–350  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

331}
332
333func TestGetFile_archive(t *testing.T) {
334 ctx := context.Background()
335
336 dst := testing_helper.TempTestFile(t)
337 defer os.RemoveAll(filepath.Dir(dst))
338 u := testModule("basic-file-archive/archive.tar.gz")
339
340 op, err := GetFile(ctx, dst, u)
341 if err != nil {
342 t.Fatalf("err: %s", err)
343 }
344 if diff := cmp.Diff(&GetResult{Dst: dst}, op); diff != "" {
345 t.Fatalf("unexpected op: %s", diff)
346 }
347
348 // Verify the main file exists
349 testing_helper.AssertContents(t, dst, "Hello\n")
350}
351func TestGetFile_filename_path_traversal(t *testing.T) {
352 dst := testing_helper.TempDir(t)
353 u := testModule("basic-file/foo.txt")

Callers

nothing calls this directly

Calls 3

testModuleFunction · 0.85
GetFileFunction · 0.85
DirMethod · 0.65

Tested by

no test coverage detected