switch vcr web backend to fakeweb, add vcr support for nico seiga tests
This commit is contained in:
2
Gemfile
2
Gemfile
@@ -8,7 +8,7 @@ group :test do
|
|||||||
gem "simplecov", :require => false
|
gem "simplecov", :require => false
|
||||||
gem "pry"
|
gem "pry"
|
||||||
gem "vcr"
|
gem "vcr"
|
||||||
gem "webmock"
|
gem "fakeweb"
|
||||||
end
|
end
|
||||||
|
|
||||||
group :assets do
|
group :assets do
|
||||||
|
|||||||
@@ -53,7 +53,6 @@ GEM
|
|||||||
activesupport (3.2.12)
|
activesupport (3.2.12)
|
||||||
i18n (~> 0.6)
|
i18n (~> 0.6)
|
||||||
multi_json (~> 1.0)
|
multi_json (~> 1.0)
|
||||||
addressable (2.3.4)
|
|
||||||
arel (3.0.2)
|
arel (3.0.2)
|
||||||
awesome_print (1.1.0)
|
awesome_print (1.1.0)
|
||||||
aws-s3 (0.6.3)
|
aws-s3 (0.6.3)
|
||||||
@@ -74,7 +73,6 @@ GEM
|
|||||||
capistrano
|
capistrano
|
||||||
chronic (0.9.1)
|
chronic (0.9.1)
|
||||||
coderay (1.0.9)
|
coderay (1.0.9)
|
||||||
crack (0.3.2)
|
|
||||||
daemons (1.1.9)
|
daemons (1.1.9)
|
||||||
delayed_job (3.0.5)
|
delayed_job (3.0.5)
|
||||||
activesupport (~> 3.0)
|
activesupport (~> 3.0)
|
||||||
@@ -89,6 +87,7 @@ GEM
|
|||||||
multi_json (~> 1.0)
|
multi_json (~> 1.0)
|
||||||
factory_girl (4.2.0)
|
factory_girl (4.2.0)
|
||||||
activesupport (>= 3.0.0)
|
activesupport (>= 3.0.0)
|
||||||
|
fakeweb (1.3.0)
|
||||||
highline (1.6.18)
|
highline (1.6.18)
|
||||||
hike (1.2.1)
|
hike (1.2.1)
|
||||||
i18n (0.6.4)
|
i18n (0.6.4)
|
||||||
@@ -200,9 +199,6 @@ GEM
|
|||||||
rack
|
rack
|
||||||
raindrops (~> 0.7)
|
raindrops (~> 0.7)
|
||||||
vcr (2.4.0)
|
vcr (2.4.0)
|
||||||
webmock (1.11.0)
|
|
||||||
addressable (>= 2.2.7)
|
|
||||||
crack (>= 0.3.2)
|
|
||||||
webrobots (0.1.1)
|
webrobots (0.1.1)
|
||||||
whenever (0.8.2)
|
whenever (0.8.2)
|
||||||
activesupport (>= 2.3.4)
|
activesupport (>= 2.3.4)
|
||||||
@@ -222,6 +218,7 @@ DEPENDENCIES
|
|||||||
delayed_job_active_record
|
delayed_job_active_record
|
||||||
diff-lcs
|
diff-lcs
|
||||||
factory_girl
|
factory_girl
|
||||||
|
fakeweb
|
||||||
ffaker!
|
ffaker!
|
||||||
mechanize!
|
mechanize!
|
||||||
memcache-client
|
memcache-client
|
||||||
@@ -245,5 +242,4 @@ DEPENDENCIES
|
|||||||
uglifier (>= 1.0.3)
|
uglifier (>= 1.0.3)
|
||||||
unicorn
|
unicorn
|
||||||
vcr
|
vcr
|
||||||
webmock
|
|
||||||
whenever
|
whenever
|
||||||
|
|||||||
2457
test/fixtures/vcr_cassettes/download-pixiv-html.yml
vendored
2457
test/fixtures/vcr_cassettes/download-pixiv-html.yml
vendored
File diff suppressed because it is too large
Load Diff
106
test/fixtures/vcr_cassettes/download-pixiv-manga.yml
vendored
106
test/fixtures/vcr_cassettes/download-pixiv-manga.yml
vendored
@@ -7,44 +7,44 @@ http_interactions:
|
|||||||
encoding: US-ASCII
|
encoding: US-ASCII
|
||||||
string: ''
|
string: ''
|
||||||
headers:
|
headers:
|
||||||
Referer:
|
referer:
|
||||||
- http://www.pixiv.net
|
- http://www.pixiv.net
|
||||||
User-Agent:
|
user-agent:
|
||||||
- ./2.8.0
|
- ./2.8.0
|
||||||
Accept:
|
accept:
|
||||||
- ! '*/*'
|
- ! '*/*'
|
||||||
response:
|
response:
|
||||||
status:
|
status:
|
||||||
code: 200
|
code: 200
|
||||||
message: OK
|
message: OK
|
||||||
headers:
|
headers:
|
||||||
Server:
|
server:
|
||||||
- nginx
|
- nginx
|
||||||
Date:
|
date:
|
||||||
- Wed, 01 May 2013 00:34:22 GMT
|
- Fri, 03 May 2013 23:23:12 GMT
|
||||||
Content-Type:
|
content-type:
|
||||||
- image/png
|
- image/png
|
||||||
Content-Length:
|
content-length:
|
||||||
- '1782713'
|
- '1782713'
|
||||||
Connection:
|
connection:
|
||||||
- keep-alive
|
- keep-alive
|
||||||
Last-Modified:
|
last-modified:
|
||||||
- Wed, 14 Sep 2011 17:28:13 GMT
|
- Wed, 14 Sep 2011 17:28:13 GMT
|
||||||
Etag:
|
etag:
|
||||||
- ! '"2e3303bf-1b33b9-4acea15afa540"'
|
- ! '"2e3303bf-1b33b9-4acea15afa540"'
|
||||||
Accept-Ranges:
|
accept-ranges:
|
||||||
- bytes
|
- bytes
|
||||||
Cache-Control:
|
cache-control:
|
||||||
- max-age=1209600
|
- max-age=1209600
|
||||||
Expires:
|
expires:
|
||||||
- Tue, 14 May 2013 23:27:19 GMT
|
- Fri, 17 May 2013 23:23:12 GMT
|
||||||
Age:
|
age:
|
||||||
- '4023'
|
- '0'
|
||||||
body:
|
body:
|
||||||
encoding: US-ASCII
|
encoding: US-ASCII
|
||||||
string: ''
|
string: ''
|
||||||
http_version:
|
http_version: '1.1'
|
||||||
recorded_at: Wed, 01 May 2013 00:34:22 GMT
|
recorded_at: Fri, 03 May 2013 23:23:12 GMT
|
||||||
- request:
|
- request:
|
||||||
method: get
|
method: get
|
||||||
uri: http://img65.pixiv.net/img/kiyoringo/21755794_big_p2.png
|
uri: http://img65.pixiv.net/img/kiyoringo/21755794_big_p2.png
|
||||||
@@ -52,51 +52,39 @@ http_interactions:
|
|||||||
encoding: US-ASCII
|
encoding: US-ASCII
|
||||||
string: ''
|
string: ''
|
||||||
headers:
|
headers:
|
||||||
User-Agent:
|
user-agent:
|
||||||
- _/2.8.0
|
- _/2.8.0
|
||||||
Referer:
|
referer:
|
||||||
- http://www.pixiv.net
|
- http://www.pixiv.net
|
||||||
Accept:
|
accept:
|
||||||
- ! '*/*'
|
- ! '*/*'
|
||||||
response:
|
response:
|
||||||
status:
|
status:
|
||||||
code: 200
|
code: 200
|
||||||
message: !binary |-
|
message: OK
|
||||||
T0s=
|
|
||||||
headers:
|
headers:
|
||||||
!binary "U2VydmVy":
|
server:
|
||||||
- !binary |-
|
- nginx
|
||||||
bmdpbng=
|
date:
|
||||||
!binary "RGF0ZQ==":
|
- Fri, 03 May 2013 23:23:12 GMT
|
||||||
- !binary |-
|
content-type:
|
||||||
V2VkLCAwMSBNYXkgMjAxMyAwMDozNDoyMiBHTVQ=
|
- image/png
|
||||||
!binary "Q29udGVudC1UeXBl":
|
content-length:
|
||||||
- !binary |-
|
- '1782713'
|
||||||
aW1hZ2UvcG5n
|
connection:
|
||||||
!binary "Q29udGVudC1MZW5ndGg=":
|
- keep-alive
|
||||||
- !binary |-
|
last-modified:
|
||||||
MTc4MjcxMw==
|
- Wed, 14 Sep 2011 17:28:13 GMT
|
||||||
!binary "Q29ubmVjdGlvbg==":
|
etag:
|
||||||
- !binary |-
|
- ! '"2e3303bf-1b33b9-4acea15afa540"'
|
||||||
a2VlcC1hbGl2ZQ==
|
accept-ranges:
|
||||||
!binary "TGFzdC1Nb2RpZmllZA==":
|
- bytes
|
||||||
- !binary |-
|
cache-control:
|
||||||
V2VkLCAxNCBTZXAgMjAxMSAxNzoyODoxMyBHTVQ=
|
- max-age=1209600
|
||||||
!binary "RXRhZw==":
|
expires:
|
||||||
- !binary |-
|
- Fri, 17 May 2013 23:23:12 GMT
|
||||||
IjJlMzMwM2JmLTFiMzNiOS00YWNlYTE1YWZhNTQwIg==
|
age:
|
||||||
!binary "QWNjZXB0LVJhbmdlcw==":
|
- '0'
|
||||||
- !binary |-
|
|
||||||
Ynl0ZXM=
|
|
||||||
!binary "Q2FjaGUtQ29udHJvbA==":
|
|
||||||
- !binary |-
|
|
||||||
bWF4LWFnZT0xMjA5NjAw
|
|
||||||
!binary "RXhwaXJlcw==":
|
|
||||||
- !binary |-
|
|
||||||
VHVlLCAxNCBNYXkgMjAxMyAyMzoyNzoxOSBHTVQ=
|
|
||||||
!binary "QWdl":
|
|
||||||
- !binary |-
|
|
||||||
NDAyMw==
|
|
||||||
body:
|
body:
|
||||||
encoding: ASCII-8BIT
|
encoding: ASCII-8BIT
|
||||||
string: !binary |-
|
string: !binary |-
|
||||||
@@ -39716,6 +39704,6 @@ http_interactions:
|
|||||||
AgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAAB
|
AgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAAB
|
||||||
AgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAAB
|
AgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAABAgQIECBAgAAB
|
||||||
AgQIECBAgAABAgQIECDwAYE/YMgpRKYZ7IsAAAAASUVORK5CYII=
|
AgQIECBAgAABAgQIECDwAYE/YMgpRKYZ7IsAAAAASUVORK5CYII=
|
||||||
http_version:
|
http_version: '1.1'
|
||||||
recorded_at: Wed, 01 May 2013 00:34:23 GMT
|
recorded_at: Fri, 03 May 2013 23:23:17 GMT
|
||||||
recorded_with: VCR 2.4.0
|
recorded_with: VCR 2.4.0
|
||||||
|
|||||||
@@ -7,11 +7,11 @@ http_interactions:
|
|||||||
encoding: US-ASCII
|
encoding: US-ASCII
|
||||||
string: ''
|
string: ''
|
||||||
headers:
|
headers:
|
||||||
User-Agent:
|
user-agent:
|
||||||
- _/2.8.0
|
- _/2.8.0
|
||||||
Referer:
|
referer:
|
||||||
- http://www.pixiv.net
|
- http://www.pixiv.net
|
||||||
Accept:
|
accept:
|
||||||
- ! '*/*'
|
- ! '*/*'
|
||||||
response:
|
response:
|
||||||
status:
|
status:
|
||||||
@@ -19,39 +19,39 @@ http_interactions:
|
|||||||
message: !binary |-
|
message: !binary |-
|
||||||
T0s=
|
T0s=
|
||||||
headers:
|
headers:
|
||||||
!binary "U2VydmVy":
|
!binary "c2VydmVy":
|
||||||
- !binary |-
|
- !binary |-
|
||||||
bmdpbng=
|
bmdpbng=
|
||||||
!binary "RGF0ZQ==":
|
!binary "ZGF0ZQ==":
|
||||||
- !binary |-
|
- !binary |-
|
||||||
V2VkLCAwMSBNYXkgMjAxMyAwMDozNDoyNCBHTVQ=
|
RnJpLCAwMyBNYXkgMjAxMyAyMzoyMzoxOCBHTVQ=
|
||||||
!binary "Q29udGVudC1UeXBl":
|
!binary "Y29udGVudC10eXBl":
|
||||||
- !binary |-
|
- !binary |-
|
||||||
aW1hZ2UvanBlZw==
|
aW1hZ2UvanBlZw==
|
||||||
!binary "Q29udGVudC1MZW5ndGg=":
|
!binary "Y29udGVudC1sZW5ndGg=":
|
||||||
- !binary |-
|
- !binary |-
|
||||||
MTg1Nzc4
|
MTg1Nzc4
|
||||||
!binary "Q29ubmVjdGlvbg==":
|
!binary "Y29ubmVjdGlvbg==":
|
||||||
- !binary |-
|
- !binary |-
|
||||||
a2VlcC1hbGl2ZQ==
|
a2VlcC1hbGl2ZQ==
|
||||||
!binary "TGFzdC1Nb2RpZmllZA==":
|
!binary "bGFzdC1tb2RpZmllZA==":
|
||||||
- !binary |-
|
- !binary |-
|
||||||
VHVlLCAxOSBNYXkgMjAwOSAyMzozNDoxMSBHTVQ=
|
VHVlLCAxOSBNYXkgMjAwOSAyMzozNDoxMSBHTVQ=
|
||||||
!binary "RXRhZw==":
|
!binary "ZXRhZw==":
|
||||||
- !binary |-
|
- !binary |-
|
||||||
ImFkZDExYzktMmQ1YjItNDZhNGM1OTBlMjJjMCI=
|
ImFkZDExYzktMmQ1YjItNDZhNGM1OTBlMjJjMCI=
|
||||||
!binary "QWNjZXB0LVJhbmdlcw==":
|
!binary "YWNjZXB0LXJhbmdlcw==":
|
||||||
- !binary |-
|
- !binary |-
|
||||||
Ynl0ZXM=
|
Ynl0ZXM=
|
||||||
!binary "Q2FjaGUtQ29udHJvbA==":
|
!binary "Y2FjaGUtY29udHJvbA==":
|
||||||
- !binary |-
|
- !binary |-
|
||||||
bWF4LWFnZT0xMjA5NjAw
|
bWF4LWFnZT0xMjA5NjAw
|
||||||
!binary "RXhwaXJlcw==":
|
!binary "ZXhwaXJlcw==":
|
||||||
- !binary |-
|
- !binary |-
|
||||||
VHVlLCAxNCBNYXkgMjAxMyAyMzoyNzoxOCBHTVQ=
|
RnJpLCAxNyBNYXkgMjAxMyAxMTozMTozMyBHTVQ=
|
||||||
!binary "QWdl":
|
!binary "YWdl":
|
||||||
- !binary |-
|
- !binary |-
|
||||||
NDAyNg==
|
NDI3MDU=
|
||||||
body:
|
body:
|
||||||
encoding: ASCII-8BIT
|
encoding: ASCII-8BIT
|
||||||
string: !binary |-
|
string: !binary |-
|
||||||
@@ -4184,6 +4184,7 @@ http_interactions:
|
|||||||
DvGOzZcGUrHy3Ep4MunzY5Ue4KSoe+oGXGtuq4FVkqjqSa+gLfx3N0nxMF54
|
DvGOzZcGUrHy3Ep4MunzY5Ue4KSoe+oGXGtuq4FVkqjqSa+gLfx3N0nxMF54
|
||||||
uS9vPLxbgUolXkf60QkHs5F291RMWfqRh/kmOpY7fIklQbpB7wD9danFlWB5
|
uS9vPLxbgUolXkf60QkHs5F291RMWfqRh/kmOpY7fIklQbpB7wD9danFlWB5
|
||||||
bJUdD6Cp8Tgup+OwhWnRD//Z
|
bJUdD6Cp8Tgup+OwhWnRD//Z
|
||||||
http_version:
|
http_version: !binary |-
|
||||||
recorded_at: Wed, 01 May 2013 00:34:25 GMT
|
MS4x
|
||||||
|
recorded_at: Fri, 03 May 2013 23:23:18 GMT
|
||||||
recorded_with: VCR 2.4.0
|
recorded_with: VCR 2.4.0
|
||||||
|
|||||||
3111
test/fixtures/vcr_cassettes/source-nico-seiga-unit-test.yml
vendored
Normal file
3111
test/fixtures/vcr_cassettes/source-nico-seiga-unit-test.yml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2358
test/fixtures/vcr_cassettes/source-pixiv-unit-test.yml
vendored
2358
test/fixtures/vcr_cassettes/source-pixiv-unit-test.yml
vendored
File diff suppressed because it is too large
Load Diff
@@ -92,6 +92,6 @@ MEMCACHE = MockMemcache.new
|
|||||||
|
|
||||||
VCR.configure do |c|
|
VCR.configure do |c|
|
||||||
c.cassette_library_dir = "test/fixtures/vcr_cassettes"
|
c.cassette_library_dir = "test/fixtures/vcr_cassettes"
|
||||||
c.hook_into :webmock
|
c.hook_into :fakeweb
|
||||||
c.allow_http_connections_when_no_cassette = true
|
c.allow_http_connections_when_no_cassette = true
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -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
|
|
||||||
@@ -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
|
|
||||||
@@ -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
|
|
||||||
@@ -7,8 +7,10 @@ module Sources
|
|||||||
context "The source site for nico seiga" do
|
context "The source site for nico seiga" do
|
||||||
setup do
|
setup do
|
||||||
# Sources::Strategies::NicoSeiga.new("http://lohas.nicoseiga.jp/priv/2853566?e=1361296671&h=794b3686b02edfd64c22ed2f99a4c55650371854")
|
# 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
|
end
|
||||||
|
|
||||||
should "get the profile" do
|
should "get the profile" do
|
||||||
|
|||||||
Reference in New Issue
Block a user