switch vcr web backend to fakeweb, add vcr support for nico seiga tests

This commit is contained in:
r888888888
2013-05-03 16:24:10 -07:00
parent 1d0c77dc7c
commit 5547f0937a
12 changed files with 5619 additions and 2524 deletions

View File

@@ -8,7 +8,7 @@ group :test do
gem "simplecov", :require => false
gem "pry"
gem "vcr"
gem "webmock"
gem "fakeweb"
end
group :assets do

View File

@@ -53,7 +53,6 @@ GEM
activesupport (3.2.12)
i18n (~> 0.6)
multi_json (~> 1.0)
addressable (2.3.4)
arel (3.0.2)
awesome_print (1.1.0)
aws-s3 (0.6.3)
@@ -74,7 +73,6 @@ GEM
capistrano
chronic (0.9.1)
coderay (1.0.9)
crack (0.3.2)
daemons (1.1.9)
delayed_job (3.0.5)
activesupport (~> 3.0)
@@ -89,6 +87,7 @@ GEM
multi_json (~> 1.0)
factory_girl (4.2.0)
activesupport (>= 3.0.0)
fakeweb (1.3.0)
highline (1.6.18)
hike (1.2.1)
i18n (0.6.4)
@@ -200,9 +199,6 @@ GEM
rack
raindrops (~> 0.7)
vcr (2.4.0)
webmock (1.11.0)
addressable (>= 2.2.7)
crack (>= 0.3.2)
webrobots (0.1.1)
whenever (0.8.2)
activesupport (>= 2.3.4)
@@ -222,6 +218,7 @@ DEPENDENCIES
delayed_job_active_record
diff-lcs
factory_girl
fakeweb
ffaker!
mechanize!
memcache-client
@@ -245,5 +242,4 @@ DEPENDENCIES
uglifier (>= 1.0.3)
unicorn
vcr
webmock
whenever

File diff suppressed because it is too large Load Diff

View File

@@ -7,44 +7,44 @@ http_interactions:
encoding: US-ASCII
string: ''
headers:
Referer:
referer:
- http://www.pixiv.net
User-Agent:
user-agent:
- ./2.8.0
Accept:
accept:
- ! '*/*'
response:
status:
code: 200
message: OK
headers:
Server:
server:
- nginx
Date:
- Wed, 01 May 2013 00:34:22 GMT
Content-Type:
date:
- Fri, 03 May 2013 23:23:12 GMT
content-type:
- image/png
Content-Length:
content-length:
- '1782713'
Connection:
connection:
- keep-alive
Last-Modified:
last-modified:
- Wed, 14 Sep 2011 17:28:13 GMT
Etag:
etag:
- ! '"2e3303bf-1b33b9-4acea15afa540"'
Accept-Ranges:
accept-ranges:
- bytes
Cache-Control:
cache-control:
- max-age=1209600
Expires:
- Tue, 14 May 2013 23:27:19 GMT
Age:
- '4023'
expires:
- Fri, 17 May 2013 23:23:12 GMT
age:
- '0'
body:
encoding: US-ASCII
string: ''
http_version:
recorded_at: Wed, 01 May 2013 00:34:22 GMT
http_version: '1.1'
recorded_at: Fri, 03 May 2013 23:23:12 GMT
- request:
method: get
uri: http://img65.pixiv.net/img/kiyoringo/21755794_big_p2.png
@@ -52,51 +52,39 @@ http_interactions:
encoding: US-ASCII
string: ''
headers:
User-Agent:
user-agent:
- _/2.8.0
Referer:
referer:
- http://www.pixiv.net
Accept:
accept:
- ! '*/*'
response:
status:
code: 200
message: !binary |-
T0s=
message: OK
headers:
!binary "U2VydmVy":
- !binary |-
bmdpbng=
!binary "RGF0ZQ==":
- !binary |-
V2VkLCAwMSBNYXkgMjAxMyAwMDozNDoyMiBHTVQ=
!binary "Q29udGVudC1UeXBl":
- !binary |-
aW1hZ2UvcG5n
!binary "Q29udGVudC1MZW5ndGg=":
- !binary |-
MTc4MjcxMw==
!binary "Q29ubmVjdGlvbg==":
- !binary |-
a2VlcC1hbGl2ZQ==
!binary "TGFzdC1Nb2RpZmllZA==":
- !binary |-
V2VkLCAxNCBTZXAgMjAxMSAxNzoyODoxMyBHTVQ=
!binary "RXRhZw==":
- !binary |-
IjJlMzMwM2JmLTFiMzNiOS00YWNlYTE1YWZhNTQwIg==
!binary "QWNjZXB0LVJhbmdlcw==":
- !binary |-
Ynl0ZXM=
!binary "Q2FjaGUtQ29udHJvbA==":
- !binary |-
bWF4LWFnZT0xMjA5NjAw
!binary "RXhwaXJlcw==":
- !binary |-
VHVlLCAxNCBNYXkgMjAxMyAyMzoyNzoxOSBHTVQ=
!binary "QWdl":
- !binary |-
NDAyMw==
server:
- nginx
date:
- Fri, 03 May 2013 23:23:12 GMT
content-type:
- image/png
content-length:
- '1782713'
connection:
- keep-alive
last-modified:
- Wed, 14 Sep 2011 17:28:13 GMT
etag:
- ! '"2e3303bf-1b33b9-4acea15afa540"'
accept-ranges:
- bytes
cache-control:
- max-age=1209600
expires:
- Fri, 17 May 2013 23:23:12 GMT
age:
- '0'
body:
encoding: ASCII-8BIT
string: !binary |-
@@ -39716,6 +39704,6 @@ http_interactions:
AgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAAB
AgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAAB
AgQIECBAgAABAgQIECDwAYE/YMgpRKYZ7IsAAAAASUVORK5CYII=
http_version:
recorded_at: Wed, 01 May 2013 00:34:23 GMT
http_version: '1.1'
recorded_at: Fri, 03 May 2013 23:23:17 GMT
recorded_with: VCR 2.4.0

View File

@@ -7,11 +7,11 @@ http_interactions:
encoding: US-ASCII
string: ''
headers:
User-Agent:
user-agent:
- _/2.8.0
Referer:
referer:
- http://www.pixiv.net
Accept:
accept:
- ! '*/*'
response:
status:
@@ -19,39 +19,39 @@ http_interactions:
message: !binary |-
T0s=
headers:
!binary "U2VydmVy":
!binary "c2VydmVy":
- !binary |-
bmdpbng=
!binary "RGF0ZQ==":
!binary "ZGF0ZQ==":
- !binary |-
V2VkLCAwMSBNYXkgMjAxMyAwMDozNDoyNCBHTVQ=
!binary "Q29udGVudC1UeXBl":
RnJpLCAwMyBNYXkgMjAxMyAyMzoyMzoxOCBHTVQ=
!binary "Y29udGVudC10eXBl":
- !binary |-
aW1hZ2UvanBlZw==
!binary "Q29udGVudC1MZW5ndGg=":
!binary "Y29udGVudC1sZW5ndGg=":
- !binary |-
MTg1Nzc4
!binary "Q29ubmVjdGlvbg==":
!binary "Y29ubmVjdGlvbg==":
- !binary |-
a2VlcC1hbGl2ZQ==
!binary "TGFzdC1Nb2RpZmllZA==":
!binary "bGFzdC1tb2RpZmllZA==":
- !binary |-
VHVlLCAxOSBNYXkgMjAwOSAyMzozNDoxMSBHTVQ=
!binary "RXRhZw==":
!binary "ZXRhZw==":
- !binary |-
ImFkZDExYzktMmQ1YjItNDZhNGM1OTBlMjJjMCI=
!binary "QWNjZXB0LVJhbmdlcw==":
!binary "YWNjZXB0LXJhbmdlcw==":
- !binary |-
Ynl0ZXM=
!binary "Q2FjaGUtQ29udHJvbA==":
!binary "Y2FjaGUtY29udHJvbA==":
- !binary |-
bWF4LWFnZT0xMjA5NjAw
!binary "RXhwaXJlcw==":
!binary "ZXhwaXJlcw==":
- !binary |-
VHVlLCAxNCBNYXkgMjAxMyAyMzoyNzoxOCBHTVQ=
!binary "QWdl":
RnJpLCAxNyBNYXkgMjAxMyAxMTozMTozMyBHTVQ=
!binary "YWdl":
- !binary |-
NDAyNg==
NDI3MDU=
body:
encoding: ASCII-8BIT
string: !binary |-
@@ -4184,6 +4184,7 @@ http_interactions:
DvGOzZcGUrHy3Ep4MunzY5Ue4KSoe+oGXGtuq4FVkqjqSa+gLfx3N0nxMF54
uS9vPLxbgUolXkf60QkHs5F291RMWfqRh/kmOpY7fIklQbpB7wD9danFlWB5
bJUdD6Cp8Tgup+OwhWnRD//Z
http_version:
recorded_at: Wed, 01 May 2013 00:34:25 GMT
http_version: !binary |-
MS4x
recorded_at: Fri, 03 May 2013 23:23:18 GMT
recorded_with: VCR 2.4.0

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -92,6 +92,6 @@ MEMCACHE = MockMemcache.new
VCR.configure do |c|
c.cassette_library_dir = "test/fixtures/vcr_cassettes"
c.hook_into :webmock
c.hook_into :fakeweb
c.allow_http_connections_when_no_cassette = true
end

View File

@@ -1,18 +0,0 @@
require 'test_helper'
module Downloads
class NicoSeigaTest < ActiveSupport::TestCase
context "a download for a nico seiga image" do
setup do
# @source = "http://img.tinami.com/illust2/img/330/4e85ecd880a8f.jpg"
# @tempfile = Tempfile.new("danbooru-test")
# @download = Downloads::File.new(@source, @tempfile.path)
end
should "work" do
# @download.download!
# assert_equal(201248, ::File.size(@tempfile.path))
end
end
end
end

View File

@@ -1,18 +0,0 @@
# require 'test_helper'
#
# module Downloads
# class PixaTest < ActiveSupport::TestCase
# context "a download for a pixa image" do
# setup do
# @source = "http://file0.pixa.cc/illustrations/6f/d6/3f/f9/51/61/29/72/23/ac/middle/sse.jpg?1317405928"
# @tempfile = Tempfile.new("danbooru-test")
# @download = Downloads::File.new(@source, @tempfile.path)
# end
#
# should "work" do
# @download.download!
# assert_equal(104627, ::File.size(@tempfile.path))
# end
# end
# end
# end

View File

@@ -1,18 +0,0 @@
# require 'test_helper'
#
# module Downloads
# class TinamiTest < ActiveSupport::TestCase
# context "a download for a pixa image" do
# setup do
# @source = "http://img.tinami.com/illust2/img/330/4e85ecd880a8f.jpg"
# @tempfile = Tempfile.new("danbooru-test")
# @download = Downloads::File.new(@source, @tempfile.path)
# end
#
# should "work" do
# @download.download!
# assert_equal(201248, ::File.size(@tempfile.path))
# end
# end
# end
# end

View File

@@ -7,8 +7,10 @@ module Sources
context "The source site for nico seiga" do
setup do
# Sources::Strategies::NicoSeiga.new("http://lohas.nicoseiga.jp/priv/2853566?e=1361296671&h=794b3686b02edfd64c22ed2f99a4c55650371854")
@site = Sources::Site.new("http://seiga.nicovideo.jp/seiga/im1464351?track=ranking")
@site.get
VCR.use_cassette("source-nico-seiga-unit-test", :record => :new_episodes) do
@site = Sources::Site.new("http://seiga.nicovideo.jp/seiga/im1464351?track=ranking")
end
end
should "get the profile" do