httplib: add Close() method to shut the server down and use it in tests

This commit is contained in:
Nick Craig-Wood
2018-02-19 14:02:19 +00:00
parent d8f78a7266
commit 334bf49d30
5 changed files with 32 additions and 9 deletions

View File

@ -39,11 +39,9 @@ func TestWebDav(t *testing.T) {
assert.NoError(t, err)
// Start the server
go func() {
w := newWebDAV(fremote, &opt)
w.serve()
}()
// FIXME shut it down somehow?
w := newWebDAV(fremote, &opt)
go w.serve()
defer w.srv.Close()
// Change directory to run the tests
err = os.Chdir("../../../backend/webdav")