tests: don't cache pixiv sessions.
This commit is contained in:
@@ -35,22 +35,6 @@ module TestHelpers
|
||||
def as_user(&block)
|
||||
CurrentUser.as(@user, &block)
|
||||
end
|
||||
|
||||
def load_pixiv_tokens!
|
||||
if ENV["DANBOORU_PERSIST_PIXIV_SESSION"] && Cache.get("pixiv-papi-access-token")
|
||||
Cache.put("pixiv-papi-access-token", Thread.current[:pixiv_papi_access_token])
|
||||
Cache.put(PixivWebAgent::SESSION_CACHE_KEY, Thread.current[:pixiv_session_cache_key])
|
||||
Cache.put(PixivWebAgent::COMIC_SESSION_CACHE_KEY, Thread.current[:pixiv_comic_session_cache_key])
|
||||
end
|
||||
end
|
||||
|
||||
def save_pixiv_tokens!
|
||||
if ENV["DANBOORU_PERSIST_PIXIV_SESSION"]
|
||||
Thread.current[:pixiv_papi_access_token] = Cache.get("pixiv-papi-access-token")
|
||||
Thread.current[:pixiv_session_cache_key] = Cache.get(PixivWebAgent::SESSION_CACHE_KEY)
|
||||
Thread.current[:pixiv_comic_session_cache_key] = Cache.get(PixivWebAgent::COMIC_SESSION_CACHE_KEY)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class ActiveSupport::TestCase
|
||||
|
||||
@@ -2,17 +2,6 @@ require 'test_helper'
|
||||
|
||||
module Downloads
|
||||
class PixivTest < ActiveSupport::TestCase
|
||||
def setup
|
||||
super
|
||||
Downloads::File.stubs(:is_cloudflare?).returns(false)
|
||||
load_pixiv_tokens!
|
||||
end
|
||||
|
||||
def teardown
|
||||
save_pixiv_tokens!
|
||||
super
|
||||
end
|
||||
|
||||
context "in all cases" do
|
||||
# Test a new illustration (one uploaded after 2014-09-30). New illustrations
|
||||
# must use /img-original/ for full size URLs. Old /imgXX/img/username/ style URLs
|
||||
|
||||
@@ -21,16 +21,6 @@ module Sources
|
||||
skip "Remote connection to #{source} failed"
|
||||
end
|
||||
|
||||
def setup
|
||||
super
|
||||
load_pixiv_tokens!
|
||||
end
|
||||
|
||||
def teardown
|
||||
save_pixiv_tokens!
|
||||
super
|
||||
end
|
||||
|
||||
context "in all cases" do
|
||||
context "A gallery page" do
|
||||
setup do
|
||||
|
||||
Reference in New Issue
Block a user