lundi 2 novembre 2020

How to test download function in Go?

I have:

err := downloadFile(url, directory, filename)
if err != nil {
  log.Error(err)
}

How can I write a test without visiting an external server to download a file from it? Is it possible with mocking? If so, do you have any examples or hints?

Aucun commentaire:

Enregistrer un commentaire