Skip to content

Commit

Permalink
add test for checksum skipping
Browse files Browse the repository at this point in the history
  • Loading branch information
azr committed Nov 19, 2018
1 parent 48a5dca commit cde3ff4
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions get_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -378,3 +378,35 @@ func TestGetFile_filename(t *testing.T) {
t.Fatalf("err: %s", err)
}
}

func TestGetFile_checksumSkip(t *testing.T) {
dst := tempFile(t)
u := testModule("basic-file/foo.txt") + "?checksum=md5:09f7e02f1290be211da707a266f153b3"

getter := &MockGetter{Proxy: new(FileGetter)}
client := &Client{
Src: u,
Dst: dst,
Dir: false,
Getters: map[string]Getter{
"file": getter,
},
}

// get the file
if err := client.Get(); err != nil {
t.Fatalf("err: %s", err)
}

if v := getter.GetFileURL.Query().Get("checksum"); v != "" {
t.Fatalf("bad: %s", v)
}

// remove file getter as
// client does the skip
client.Getters["file"] = nil

if err := client.Get(); err != nil {
t.Fatalf("err: %s", err)
}
}

0 comments on commit cde3ff4

Please sign in to comment.