hollywood cemetery

This commit is contained in:
Mark Bates 2019-09-03 16:46:51 -04:00
parent ee082ed548
commit 5e7309c6ab
1 changed files with 16 additions and 13 deletions

View File

@ -56,8 +56,6 @@ func (s Suite) Test_HTTP_Dir(t *testing.T) {
r.NoError(err) r.NoError(err)
ip := cur.ImportPath ip := cur.ImportPath
r.NoError(s.LoadFolder())
table := []struct { table := []struct {
in string in string
req string req string
@ -69,20 +67,25 @@ func (s Suite) Test_HTTP_Dir(t *testing.T) {
} }
for _, tt := range table { for _, tt := range table {
s.Run(t, tt.in+tt.req, func(st *testing.T) {
dir, err := s.Open(tt.in) r := require.New(t)
r.NoError(err) r.NoError(s.LoadFolder())
ts := httptest.NewServer(http.FileServer(dir))
defer ts.Close()
res, err := http.Get(ts.URL + tt.req) dir, err := s.Open(tt.in)
r.NoError(err) r.NoError(err)
r.Equal(200, res.StatusCode) ts := httptest.NewServer(http.FileServer(dir))
defer ts.Close()
b, err := ioutil.ReadAll(res.Body) res, err := http.Get(ts.URL + tt.req)
r.NoError(err) r.NoError(err)
r.Contains(string(b), tt.exp) r.Equal(200, res.StatusCode)
r.NotContains(string(b), "mark.png")
b, err := ioutil.ReadAll(res.Body)
r.NoError(err)
r.Contains(string(b), tt.exp)
r.NotContains(string(b), "mark.png")
})
} }
} }