Skip to content

Commit

Permalink
Fix wayback testing (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
waybackarchiver authored Apr 14, 2023
1 parent d29b2a7 commit 2d29d1f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 0 additions & 2 deletions ia.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,6 @@ func (wbrc *Archiver) archive(ctx context.Context, u *url.URL) (string, error) {
return fmt.Sprint(loc), nil
}

logger.Error("The Internet Archive: %s for url: %s", resp.Status, base+uri)

return loc, nil
}

Expand Down
11 changes: 10 additions & 1 deletion ia_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,21 @@ const available = `{
}`

func TestWayback(t *testing.T) {
httpClient, mux, server := helper.MockServer()
defer server.Close()

mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
if r.URL.Path == "/wayback/available" {
_, _ = w.Write([]byte(available))
}
})

uri := "https://example.com"
u, err := url.Parse(uri)
if err != nil {
t.Fatal(err)
}
wbrc := &Archiver{}
wbrc := &Archiver{Client: httpClient}
got, err := wbrc.Wayback(context.Background(), u)
if err != nil {
t.Log(got)
Expand Down

0 comments on commit 2d29d1f

Please sign in to comment.