Skip to content

Commit

Permalink
Rename fakenewsbox to fakebox
Browse files Browse the repository at this point in the history
  • Loading branch information
dahernan committed Sep 6, 2017
1 parent 81375a0 commit 35b0d8f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions fakenewsbox/fakenewsbox.go → fakebox/fakebox.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Package fakenewsbox provides a client for accessing fakenewsbox services.
package fakenewsbox
// Package fakebox provides a client for accessing fakebox services.
package fakebox

import (
"encoding/json"
Expand Down Expand Up @@ -114,9 +114,9 @@ func (c *Client) Info() (*boxutil.Info, error) {
return &info, nil
}

// Check passes the text from the Reader to fakenewsbox for analysis.
// Check passes the text from the Reader to fakebox for analysis.
func (c *Client) Check(title string, content string, u *url.URL) (*Analysis, error) {
uu, err := url.Parse(c.addr + "/fakenewsbox/check")
uu, err := url.Parse(c.addr + "/fakebox/check")
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -160,9 +160,9 @@ func (c *Client) Check(title string, content string, u *url.URL) (*Analysis, err
}, nil
}

// ErrNewsbox represents an error from fakenewsbox.
// ErrNewsbox represents an error from fakebox.
type ErrNewsbox string

func (e ErrNewsbox) Error() string {
return "fakenewsbox: " + string(e)
return "fakebox: " + string(e)
}
8 changes: 4 additions & 4 deletions fakenewsbox/fakenewsbox_test.go → fakebox/fakebox_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package fakenewsbox_test
package fakebox_test

import (
"io"
Expand All @@ -7,7 +7,7 @@ import (
"net/url"
"testing"

"github.com/machinebox/sdk-go/fakenewsbox"
"github.com/machinebox/sdk-go/fakebox"
"github.com/matryer/is"
)

Expand Down Expand Up @@ -122,15 +122,15 @@ func TestCheck(t *testing.T) {
is := is.New(t)
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
is.Equal(r.Method, "POST")
is.Equal(r.URL.Path, "/fakenewsbox/check")
is.Equal(r.URL.Path, "/fakebox/check")
is.Equal(r.Header.Get("Accept"), "application/json; charset=utf-8")
io.WriteString(w, result)
}))
defer srv.Close()
u, err := url.Parse("http://www.bbc.co.uk/news/technology-41011662")
is.NoErr(err)

tb := fakenewsbox.New(srv.URL)
tb := fakebox.New(srv.URL)
res, err := tb.Check(`China relaunches world's fastest train`,
`The top speed of the Fuxing or "rejuvenation" bullet trains was capped at 300km/h (186mph) in 2011 following two crashes that killed 40 people.
From next week, some of the trains will once again be allowed to run at a higher speed of about 350 km/h.`,
Expand Down

0 comments on commit 35b0d8f

Please sign in to comment.