From 1e35e8c422ee9c5cb0556726b3a23f84542ec0aa Mon Sep 17 00:00:00 2001 From: Michael Hobbs Date: Thu, 23 Apr 2020 10:29:17 -0700 Subject: [PATCH] remove TestGetURLGalleryImageSimulated --- fromURL.go | 2 +- fromURL_test.go | 32 -------------------------------- 2 files changed, 1 insertion(+), 33 deletions(-) diff --git a/fromURL.go b/fromURL.go index 5038ef4..5160c5e 100644 --- a/fromURL.go +++ b/fromURL.go @@ -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 diff --git a/fromURL_test.go b/fromURL_test.go index aeadcfd..75064cd 100644 --- a/fromURL_test.go +++ b/fromURL_test.go @@ -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 == "" {