fixes #2432, fix tests

This commit is contained in:
r888888888
2015-07-14 15:13:04 -07:00
parent 2c8cacd50e
commit 6ad6aa44c4
13 changed files with 6809 additions and 841 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -8,42 +8,72 @@ http_interactions:
string: ''
headers:
User-Agent:
- _/2.61.0
- dior/2.85.0
Accept-Encoding:
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
Accept:
- ! '*/*'
- "*/*"
response:
status:
code: 301
message: Moved Permanently
headers:
Content-Type:
- text/html
Date:
- Tue, 14 Jul 2015 22:12:20 GMT
Location:
- http://orig02.deviantart.net/a45d/f/2012/330/e/7/resolution_by_mochikko-d5m713n.jpg
Server:
- nginx
Content-Length:
- '178'
body:
encoding: UTF-8
string: "<html>\r\n<head><title>301 Moved Permanently</title></head>\r\n<body
bgcolor=\"white\">\r\n<center><h1>301 Moved Permanently</h1></center>\r\n<hr><center>nginx</center>\r\n</body>\r\n</html>\r\n"
http_version:
recorded_at: Tue, 14 Jul 2015 22:12:25 GMT
- request:
method: get
uri: http://orig02.deviantart.net/a45d/f/2012/330/e/7/resolution_by_mochikko-d5m713n.jpg
body:
encoding: US-ASCII
string: ''
headers:
User-Agent:
- dior/2.85.0
Accept-Encoding:
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
Accept:
- "*/*"
response:
status:
code: 200
message: !binary |-
T0s=
message: OK
headers:
!binary "QWNjZXB0LVJhbmdlcw==":
- !binary |-
Ynl0ZXM=
!binary "Q2FjaGUtQ29udHJvbA==":
- !binary |-
bWF4LWFnZT0zMTUzNjAwMA==
!binary "Q29udGVudC1UeXBl":
- !binary |-
aW1hZ2UvanBlZw==
!binary "RGF0ZQ==":
- !binary |-
V2VkLCAyMiBPY3QgMjAxNCAyMzozNjoxOSBHTVQ=
!binary "RXhwaXJlcw==":
- !binary |-
VGh1LCAyMiBPY3QgMjAxNSAyMzozNjoxOSBHTVQ=
!binary "TGFzdC1Nb2RpZmllZA==":
- !binary |-
U3VuLCAyNSBOb3YgMjAxMiAwODoxMjo0MCBHTVQ=
!binary "U2VydmVy":
- !binary |-
RUNBY2MgKHNqYy80RTlGKQ==
!binary "WC1DYWNoZQ==":
- !binary |-
SElU
!binary "Q29udGVudC1MZW5ndGg=":
- !binary |-
MjU1Njgz
Accept-Ranges:
- bytes
Cache-Control:
- max-age=259200
Content-Type:
- image/jpeg
Date:
- Tue, 14 Jul 2015 22:12:20 GMT
Etag:
- '"33a5ef3af6158ccb669e8ee22b9d4a54"'
Last-Modified:
- Fri, 22 May 2015 00:40:24 GMT
Server:
- ECAcc (sjc/16FA)
X-Amz-Id-2:
- 3GwpuEJtUDl6pP2C1PfWEESTxj3Tt7uiqZTDuY2drguHH95ZpTxMhrtgHRaw0Ums
X-Amz-Request-Id:
- CC4A2CDD5512378F
X-Cache:
- HIT
Content-Length:
- '255683'
body:
encoding: ASCII-8BIT
string: !binary |-
@@ -5730,5 +5760,5 @@ http_interactions:
qi+/x/rqDmoF4w7t/Eb/AIaEhlWHYi7AsKjqP2j922hIAKo0ROVP86f5j4aF
C6TpU8v8fD7tCo6T3Qk/jQ/HU7VTt3IEbbeI6/8AjqAoZYuv/9k=
http_version:
recorded_at: Wed, 22 Oct 2014 23:36:24 GMT
recorded_at: Tue, 14 Jul 2015 22:12:25 GMT
recorded_with: VCR 2.9.0

View File

@@ -7,13 +7,13 @@ module Downloads
@source = "http://mochikko.deviantart.com/art/RESOLUTION-339610451"
@tempfile = Tempfile.new("danbooru-test")
@download = Downloads::File.new(@source, @tempfile.path)
VCR.use_cassette("download-deviant-art-html", :record => :none) do
VCR.use_cassette("download-deviant-art-html", :record => :once) do
@download.download!
end
end
should "set the direct image link as the source" do
assert_equal("http://fc03.deviantart.net/fs71/f/2012/330/e/7/resolution_by_mochikko-d5m713n.jpg", @download.source)
should "set the html page as the source" do
assert_equal("http://orig02.deviantart.net/a45d/f/2012/330/e/7/resolution_by_mochikko-d5m713n.jpg", @download.source)
end
should "work" do
@@ -26,13 +26,13 @@ module Downloads
@source = "http://fc03.deviantart.net/fs71/200H/f/2012/330/e/7/resolution_by_mochikko-d5m713n.jpg"
@tempfile = Tempfile.new("danbooru-test")
@download = Downloads::File.new(@source, @tempfile.path)
VCR.use_cassette("download-deviant-art-thumb", :record => :none) do
VCR.use_cassette("download-deviant-art-thumb", :record => :once) do
@download.download!
end
end
should "instead download the original version" do
assert_equal("http://fc03.deviantart.net/fs71/f/2012/330/e/7/resolution_by_mochikko-d5m713n.jpg", @download.source)
assert_equal("http://orig02.deviantart.net/a45d/f/2012/330/e/7/resolution_by_mochikko-d5m713n.jpg", @download.source)
end
should "work" do

View File

@@ -109,18 +109,6 @@ class ForumPostTest < ActiveSupport::TestCase
assert_equal(@user.id, post.creator_id)
end
context "that is deleted" do
setup do
@post = FactoryGirl.create(:forum_post, :topic_id => @topic.id)
@post.delete!
@topic.reload
end
should "also delete the topic" do
assert(@topic.is_deleted)
end
end
context "updated by a second user" do
setup do
@post = FactoryGirl.create(:forum_post, :topic_id => @topic.id)

View File

@@ -1463,6 +1463,7 @@ class PostTest < ActiveSupport::TestCase
context "The cache" do
context "when shared between users on danbooru/safebooru" do
setup do
Danbooru.config.stubs(:blank_tag_search_fast_count).returns(nil)
FactoryGirl.create(:post, :tag_string => "aaa bbb", :rating => "q")
FactoryGirl.create(:post, :tag_string => "aaa bbb", :rating => "s")
FactoryGirl.create(:post, :tag_string => "aaa bbb", :rating => "s")