Get single item test

master
Bel LaPointe 2018-10-09 19:37:22 -06:00
parent d13c411193
commit 822766e780
1 changed files with 9 additions and 1 deletions

View File

@ -56,6 +56,12 @@ func Test_Core(t *testing.T) {
body: "https://utw.me/feed/", body: "https://utw.me/feed/",
status: 200, status: 200,
}, },
{
method: "get",
path: "api/feed/item",
body: "https___utw_me_feed_.20180108_https___utw_me_2018_01_08_fate_apocrypha_25_",
status: 200,
},
} }
for _, c := range cases { for _, c := range cases {
c.method = strings.ToUpper(c.method) c.method = strings.ToUpper(c.method)
@ -82,8 +88,10 @@ func Test_Core(t *testing.T) {
t.Errorf("cannot %s to %s: %v", c.method, loc.String(), err) t.Errorf("cannot %s to %s: %v", c.method, loc.String(), err)
} else if resp.StatusCode != c.status { } else if resp.StatusCode != c.status {
t.Errorf("wrong %s status to %s: %v, expected %v", c.method, loc.String(), resp.StatusCode, c.status) t.Errorf("wrong %s status to %s: %v, expected %v", c.method, loc.String(), resp.StatusCode, c.status)
} else if _, err := ioutil.ReadAll(resp.Body); err != nil { } else if b, err := ioutil.ReadAll(resp.Body); err != nil {
t.Errorf("cannot read body on %s to %s: %v", c.method, loc.String(), err) t.Errorf("cannot read body on %s to %s: %v", c.method, loc.String(), err)
} else {
t.Logf("resp body: %s", b)
} }
if c.post != nil { if c.post != nil {
c.post() c.post()