fix tests
This commit is contained in:
@@ -44,6 +44,7 @@ class PoolElementsControllerTest < ActionDispatch::IntegrationTest
|
||||
end
|
||||
|
||||
should "do nothing if the post is not a member of the pool" do
|
||||
@pool.reload
|
||||
as_user do
|
||||
@pool.remove!(@post)
|
||||
end
|
||||
|
||||
@@ -3,7 +3,7 @@ require 'test_helper'
|
||||
class PostKeeperManagerTest < ActiveSupport::TestCase
|
||||
subject { PostKeeperManager }
|
||||
|
||||
context "#check_and_update" do
|
||||
context "#check_and_assign" do
|
||||
setup do
|
||||
Timecop.travel(1.month.ago) do
|
||||
@alice = FactoryBot.create(:user)
|
||||
@@ -17,19 +17,21 @@ class PostKeeperManagerTest < ActiveSupport::TestCase
|
||||
end
|
||||
CurrentUser.scoped(@bob) do
|
||||
Timecop.travel(2.hours.from_now) do
|
||||
@post.update_attributes(tag_string: "aaa bbb ccc")
|
||||
@post.reload
|
||||
@post.update(tag_string: "aaa bbb ccc")
|
||||
end
|
||||
end
|
||||
CurrentUser.scoped(@carol) do
|
||||
Timecop.travel(4.hours.from_now) do
|
||||
@post.update_attributes(tag_string: "ccc ddd eee fff ggg")
|
||||
@post.reload
|
||||
@post.update(tag_string: "ccc ddd eee fff ggg")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
should "update the post" do
|
||||
subject.check_and_update(@post.id)
|
||||
@post.reload
|
||||
assert_equal(3, @post.versions.count)
|
||||
subject.check_and_assign(@post)
|
||||
assert_equal({"uid" => @carol.id}, @post.keeper_data)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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!
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user