Skip to content

Commit

Permalink
remove TestGetURLGalleryImageSimulated
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelshobbs authored and jbreitbart committed Apr 24, 2020
1 parent c7e12ff commit 1e35e8c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 33 deletions.
2 changes: 1 addition & 1 deletion fromURL.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func (client *Client) galleryURL(url string) (*GenericInfo, int, error) {
return &ret, status, err
}
// fallback to GetGalleryImageInfo
client.Log.Debugf("Failed to retrieve imgur gallery album. Attempting to retrieve imgur gallery image")
client.Log.Debugf("Failed to retrieve imgur gallery album. Attempting to retrieve imgur gallery image. err: %v status: %d", err, status)
ii, status, err := client.GetGalleryImageInfo(id)
ret.GImage = ii
return &ret, status, err
Expand Down
32 changes: 0 additions & 32 deletions fromURL_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,38 +205,6 @@ func TestGetFromURLGAlbumReal(t *testing.T) {
}
}

func TestGetURLGalleryImageSimulated(t *testing.T) {
httpC, server := testHTTPClientJSON("{\"data\":{\"id\":\"uPI76jY\",\"title\":\"The Tridge. (three way bridge)\",\"description\":null,\"datetime\":1316367003,\"type\":\"image\\/jpeg\",\"animated\":false,\"width\":1700,\"height\":1133,\"size\":268126,\"views\":1342557,\"bandwidth\":359974438182,\"vote\":null,\"favorite\":false,\"nsfw\":false,\"section\":\"pics\",\"account_url\":null,\"account_id\":null,\"in_gallery\":true,\"topic\":null,\"topic_id\":0,\"link\":\"https:\\/\\/i.imgur.com\\/uPI76jY.jpg\",\"comment_count\":90,\"ups\":585,\"downs\":3,\"points\":582,\"score\":1136,\"is_album\":false},\"success\":true,\"status\":200}")
defer server.Close()

client := new(Client)
client.HTTPClient = httpC
client.Log = new(klogger.CLILogger)
client.ImgurClientID = "testing"

ge, status, err := client.GetInfoFromURL("https://imgur.com/gallery/uPI76jY")

if err != nil {
t.Errorf("GetInfoFromURL() failed with error: %v", err)
t.FailNow()
}

if ge.Album != nil || ge.GAlbum != nil || ge.GImage == nil || ge.Image != nil {
t.Error("GetInfoFromURL() failed. Returned wrong type.")
t.FailNow()
}

img := ge.GImage

if img.Title != "The Tridge. (three way bridge)" || img.Animated != false || img.Bandwidth != 359974438182 || img.Datetime != 1316367003 || img.Description != "" || img.Height != 1133 || img.Width != 1700 || img.ID != "uPI76jY" || img.Link != "https://i.imgur.com/uPI76jY.jpg" || img.Views != 1342557 {
t.Fail()
}

if status != 200 {
t.Fail()
}
}

func TestGetURLGalleryImageReal(t *testing.T) {
key := os.Getenv("IMGURCLIENTID")
if key == "" {
Expand Down

0 comments on commit 1e35e8c

Please # to comment.