Merge branch 'master' into skeb
This commit is contained in:
@@ -95,20 +95,30 @@ module Sources
|
||||
should "fetch the source data" do
|
||||
assert_equal("evazion", @site.artist_name)
|
||||
end
|
||||
|
||||
should "correctly get the page url" do
|
||||
assert_equal(@ref, @site.page_url)
|
||||
end
|
||||
end
|
||||
|
||||
context "A baraag url" do
|
||||
setup do
|
||||
skip "Baraag keys not set" unless Danbooru.config.baraag_client_id
|
||||
@url = "https://baraag.net/@bardbot/105732813175612920"
|
||||
@site = Sources::Strategies.find(@url)
|
||||
@site1 = Sources::Strategies.find(@url)
|
||||
|
||||
@img = "https://baraag.net/system/media_attachments/files/105/803/948/862/719/091/original/54e1cb7ca33ec449.png"
|
||||
@ref = "https://baraag.net/@Nakamura/105803949565505009"
|
||||
@site2 = Sources::Strategies.find(@img, @ref)
|
||||
end
|
||||
|
||||
should "work" do
|
||||
assert_equal("https://baraag.net/@bardbot", @site.profile_url)
|
||||
assert_equal(["https://baraag.net/system/media_attachments/files/105/732/803/241/495/700/original/556e1eb7f5ca610f.png"], @site.image_urls)
|
||||
assert_equal("bardbot", @site.artist_name)
|
||||
assert_equal("🍌", @site.dtext_artist_commentary_desc)
|
||||
assert_equal("https://baraag.net/@bardbot", @site1.profile_url)
|
||||
assert_equal(["https://baraag.net/system/media_attachments/files/105/732/803/241/495/700/original/556e1eb7f5ca610f.png"], @site1.image_urls)
|
||||
assert_equal("bardbot", @site1.artist_name)
|
||||
assert_equal("🍌", @site1.dtext_artist_commentary_desc)
|
||||
|
||||
assert_equal([@img], @site2.image_urls)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -305,6 +305,18 @@ module Sources
|
||||
end
|
||||
end
|
||||
|
||||
context "when the cached session cookie is invalid" do
|
||||
should "clear the cached cookie after failing to fetch the data" do
|
||||
site = Sources::Strategies.find("https://nijie.info/view.php?id=203688")
|
||||
|
||||
Cache.put("nijie-session-cookie", HTTP::Cookie.new(name: "NIJIEIJIEID", value: "fake", domain: "nijie.info", path: "/"))
|
||||
assert_equal("fake", site.cached_session_cookie.value)
|
||||
|
||||
assert_equal([], site.image_urls)
|
||||
assert_nil(Cache.get("nijie-session-cookie"))
|
||||
end
|
||||
end
|
||||
|
||||
context "a doujin post" do
|
||||
should "work" do
|
||||
image = "https://pic.nijie.net/01/dojin_main/dojin_sam/20120213044700%E3%82%B3%E3%83%94%E3%83%BC%20%EF%BD%9E%200011%E3%81%AE%E3%82%B3%E3%83%94%E3%83%BC.jpg"
|
||||
|
||||
Reference in New Issue
Block a user