fix tests

This commit is contained in:
Albert Yi
2018-05-09 11:56:01 -07:00
parent 81d94dbab9
commit 99012ff342
13 changed files with 33 additions and 12 deletions

View File

@@ -191,7 +191,7 @@ class ArtistTest < ActiveSupport::TestCase
context "when finding deviantart artists" do
setup do
skip "deviant art is not configured" unless Danbooru.config.deviantart_client_id.present?
skip "DeviantArt API keys not set" unless Danbooru.config.deviantart_client_id.present?
FactoryBot.create(:artist, :name => "artgerm", :url_string => "http://artgerm.deviantart.com/")
FactoryBot.create(:artist, :name => "trixia", :url_string => "http://trixdraws.deviantart.com/")
end

View File

@@ -4,6 +4,8 @@ module Downloads
class DeviantArtTest < ActiveSupport::TestCase
context "a download for a deviant art html page" do
setup do
skip "DeviantArt API keys not set" unless Danbooru.config.deviantart_client_id.present?
@source = "http://starbitt.deviantart.com/art/09271X-636962118"
@download = Downloads::File.new(@source)
@tempfile = @download.download!

View File

@@ -11,6 +11,7 @@ module Moderator
@comment = FactoryBot.create(:comment)
PoolArchive.stubs(:enabled?).returns(false)
PostArchive.stubs(:enabled?).returns(false)
@user.reload
end
teardown do

View File

@@ -73,19 +73,24 @@ class PoolTest < ActiveSupport::TestCase
@p3 = FactoryBot.create(:post)
CurrentUser.scoped(@user, "1.2.3.4") do
@pool.add!(@p1)
@pool.reload
end
CurrentUser.scoped(@user, "1.2.3.5") do
@pool.add!(@p2)
@pool.reload
end
CurrentUser.scoped(@user, "1.2.3.6") do
@pool.add!(@p3)
@pool.reload
end
CurrentUser.scoped(@user, "1.2.3.7") do
@pool.remove!(@p1)
@pool.reload
end
CurrentUser.scoped(@user, "1.2.3.8") do
version = @pool.versions[1]
@pool.revert_to!(version)
@pool.reload
end
end

View File

@@ -2,6 +2,11 @@ require 'test_helper'
module Sources
class DeviantArtTest < ActiveSupport::TestCase
def setup
super
skip "DeviantArt API keys not set" unless Danbooru.config.deviantart_client_id.present?
end
context "The source for a private DeviantArt image URL" do
setup do
@site = Sources::Site.new("https://pre00.deviantart.net/423b/th/pre/i/2017/281/e/0/mindflayer_girl01_by_nickbeja-dbpxdt8.png")