fixes #2327
This commit is contained in:
2669
test/fixtures/vcr_cassettes/source-pixiv-old-illust.yml
vendored
2669
test/fixtures/vcr_cassettes/source-pixiv-old-illust.yml
vendored
File diff suppressed because it is too large
Load Diff
3642
test/fixtures/vcr_cassettes/ugoira-converter.yml
vendored
3642
test/fixtures/vcr_cassettes/ugoira-converter.yml
vendored
File diff suppressed because it is too large
Load Diff
208
test/fixtures/vcr_cassettes/upload-new-twitter.yml
vendored
Normal file
208
test/fixtures/vcr_cassettes/upload-new-twitter.yml
vendored
Normal file
@@ -0,0 +1,208 @@
|
||||
---
|
||||
http_interactions:
|
||||
- request:
|
||||
method: post
|
||||
uri: https://ocqPCKeWr01mvWzCIcveJYRTY:8GECMr2Ves7oK3bmAneHYMLSfDPoJvTizh5gSd4pLBNbJfYNz5@api.twitter.com/oauth2/token
|
||||
body:
|
||||
encoding: UTF-8
|
||||
string: grant_type=client_credentials
|
||||
headers:
|
||||
Accept:
|
||||
- "*/*"
|
||||
User-Agent:
|
||||
- TwitterRubyGem/5.13.0
|
||||
Content-Type:
|
||||
- application/x-www-form-urlencoded; charset=UTF-8
|
||||
Accept-Encoding:
|
||||
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
||||
response:
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
headers:
|
||||
Cache-Control:
|
||||
- private, max-age=0, must-revalidate
|
||||
Content-Disposition:
|
||||
- attachment; filename=json.json
|
||||
Content-Length:
|
||||
- '151'
|
||||
Content-Type:
|
||||
- application/json;charset=utf-8
|
||||
Date:
|
||||
- Fri, 22 May 2015 23:57:30 GMT
|
||||
Expires:
|
||||
- Tue, 31 Mar 1981 05:00:00 GMT
|
||||
Last-Modified:
|
||||
- Fri, 22 May 2015 23:57:30 GMT
|
||||
Ml:
|
||||
- S
|
||||
Pragma:
|
||||
- no-cache
|
||||
Server:
|
||||
- tsa_a
|
||||
Set-Cookie:
|
||||
- guest_id=v1%3A143233904999810992; Domain=.twitter.com; Path=/; Expires=Sun,
|
||||
21-May-2017 23:57:30 UTC
|
||||
Status:
|
||||
- 200 OK
|
||||
Strict-Transport-Security:
|
||||
- max-age=631138519
|
||||
X-Connection-Hash:
|
||||
- 5d36414acb4d4d37865904c4cae7542d
|
||||
X-Content-Type-Options:
|
||||
- nosniff
|
||||
X-Frame-Options:
|
||||
- SAMEORIGIN
|
||||
X-Response-Time:
|
||||
- '11'
|
||||
X-Transaction:
|
||||
- 911384da81767843
|
||||
X-Tsa-Request-Body-Time:
|
||||
- '4'
|
||||
X-Twitter-Response-Tags:
|
||||
- BouncerCompliant
|
||||
X-Ua-Compatible:
|
||||
- IE=edge,chrome=1
|
||||
X-Xss-Protection:
|
||||
- 1; mode=block
|
||||
body:
|
||||
encoding: UTF-8
|
||||
string: '{"token_type":"bearer","access_token":"AAAAAAAAAAAAAAAAAAAAAPV7eAAAAAAAN7q56yJ8wNHhsagDn06qiJ0Io00%3DfdvXQaVKHFS3q1hd3y8fVQdIbntIHN2iTsBTk0f6jQK7lxcDo5"}'
|
||||
http_version:
|
||||
recorded_at: Fri, 22 May 2015 23:57:30 GMT
|
||||
- request:
|
||||
method: get
|
||||
uri: https://api.twitter.com/1.1/statuses/show/566030116182949888.json
|
||||
body:
|
||||
encoding: US-ASCII
|
||||
string: ''
|
||||
headers:
|
||||
Accept:
|
||||
- application/json
|
||||
User-Agent:
|
||||
- TwitterRubyGem/5.13.0
|
||||
Authorization:
|
||||
- Bearer AAAAAAAAAAAAAAAAAAAAAPV7eAAAAAAAN7q56yJ8wNHhsagDn06qiJ0Io00%3DfdvXQaVKHFS3q1hd3y8fVQdIbntIHN2iTsBTk0f6jQK7lxcDo5
|
||||
Accept-Encoding:
|
||||
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
||||
response:
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
headers:
|
||||
Cache-Control:
|
||||
- no-cache, no-store, must-revalidate, pre-check=0, post-check=0
|
||||
Content-Disposition:
|
||||
- attachment; filename=json.json
|
||||
Content-Length:
|
||||
- '1237'
|
||||
Content-Type:
|
||||
- application/json;charset=utf-8
|
||||
Date:
|
||||
- Fri, 22 May 2015 23:57:30 GMT
|
||||
Expires:
|
||||
- Tue, 31 Mar 1981 05:00:00 GMT
|
||||
Last-Modified:
|
||||
- Fri, 22 May 2015 23:57:30 GMT
|
||||
Pragma:
|
||||
- no-cache
|
||||
Server:
|
||||
- tsa_a
|
||||
Set-Cookie:
|
||||
- guest_id=v1%3A143233905025943870; Domain=.twitter.com; Path=/; Expires=Sun,
|
||||
21-May-2017 23:57:30 UTC
|
||||
Status:
|
||||
- 200 OK
|
||||
Strict-Transport-Security:
|
||||
- max-age=631138519
|
||||
X-Access-Level:
|
||||
- read
|
||||
X-Connection-Hash:
|
||||
- 1ca5a3dd668b6b3ec0c298fb2d248479
|
||||
X-Content-Type-Options:
|
||||
- nosniff
|
||||
X-Frame-Options:
|
||||
- SAMEORIGIN
|
||||
X-Rate-Limit-Limit:
|
||||
- '180'
|
||||
X-Rate-Limit-Remaining:
|
||||
- '176'
|
||||
X-Rate-Limit-Reset:
|
||||
- '1432339397'
|
||||
X-Response-Time:
|
||||
- '21'
|
||||
X-Transaction:
|
||||
- ebb6ec42be36ba79
|
||||
X-Twitter-Response-Tags:
|
||||
- BouncerCompliant
|
||||
X-Xss-Protection:
|
||||
- 1; mode=block
|
||||
body:
|
||||
encoding: UTF-8
|
||||
string: '{"created_at":"Fri Feb 13 00:24:30 +0000 2015","id":566030116182949888,"id_str":"566030116182949888","text":"What
|
||||
do you give the Caramel Frappuccino that already has everything? The gift
|
||||
of mocha drizzle. http:\/\/t.co\/2MWtXbYhf0","source":"\u003ca href=\"http:\/\/twitter.com\/download\/iphone\"
|
||||
rel=\"nofollow\"\u003eTwitter for iPhone\u003c\/a\u003e","truncated":false,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"user":{"id":127566622,"id_str":"127566622","name":"Frappuccino","screen_name":"frappuccino","location":"Seattle,
|
||||
WA","description":"Le yum.","url":"http:\/\/t.co\/fZct7xT8Hn","entities":{"url":{"urls":[{"url":"http:\/\/t.co\/fZct7xT8Hn","expanded_url":"http:\/\/www.Frappuccino.com","display_url":"Frappuccino.com","indices":[0,22]}]},"description":{"urls":[]}},"protected":false,"followers_count":176886,"friends_count":68023,"listed_count":715,"created_at":"Mon
|
||||
Mar 29 16:30:39 +0000 2010","favourites_count":3588,"utc_offset":-25200,"time_zone":"Pacific
|
||||
Time (US & Canada)","geo_enabled":true,"verified":true,"statuses_count":11814,"lang":"en","contributors_enabled":false,"is_translator":false,"is_translation_enabled":false,"profile_background_color":"9AE4E8","profile_background_image_url":"http:\/\/pbs.twimg.com\/profile_background_images\/486908690591535104\/roRpLqRU.jpeg","profile_background_image_url_https":"https:\/\/pbs.twimg.com\/profile_background_images\/486908690591535104\/roRpLqRU.jpeg","profile_background_tile":true,"profile_image_url":"http:\/\/pbs.twimg.com\/profile_images\/593460960020402176\/B_NNVW9D_normal.png","profile_image_url_https":"https:\/\/pbs.twimg.com\/profile_images\/593460960020402176\/B_NNVW9D_normal.png","profile_banner_url":"https:\/\/pbs.twimg.com\/profile_banners\/127566622\/1420826895","profile_link_color":"0084B4","profile_sidebar_border_color":"FFFFFF","profile_sidebar_fill_color":"DDFFCC","profile_text_color":"333333","profile_use_background_image":true,"default_profile":false,"default_profile_image":false,"following":null,"follow_request_sent":null,"notifications":null},"geo":null,"coordinates":null,"place":null,"contributors":null,"retweet_count":632,"favorite_count":2385,"entities":{"hashtags":[],"symbols":[],"user_mentions":[],"urls":[],"media":[{"id":566030112210972672,"id_str":"566030112210972672","indices":[97,119],"media_url":"http:\/\/pbs.twimg.com\/media\/B9rxY1qCcAAbeo0.jpg","media_url_https":"https:\/\/pbs.twimg.com\/media\/B9rxY1qCcAAbeo0.jpg","url":"http:\/\/t.co\/2MWtXbYhf0","display_url":"pic.twitter.com\/2MWtXbYhf0","expanded_url":"http:\/\/twitter.com\/frappuccino\/status\/566030116182949888\/photo\/1","type":"photo","sizes":{"thumb":{"w":150,"h":150,"resize":"crop"},"small":{"w":340,"h":191,"resize":"fit"},"medium":{"w":600,"h":337,"resize":"fit"},"large":{"w":1024,"h":576,"resize":"fit"}}}]},"extended_entities":{"media":[{"id":566030112210972672,"id_str":"566030112210972672","indices":[97,119],"media_url":"http:\/\/pbs.twimg.com\/media\/B9rxY1qCcAAbeo0.jpg","media_url_https":"https:\/\/pbs.twimg.com\/media\/B9rxY1qCcAAbeo0.jpg","url":"http:\/\/t.co\/2MWtXbYhf0","display_url":"pic.twitter.com\/2MWtXbYhf0","expanded_url":"http:\/\/twitter.com\/frappuccino\/status\/566030116182949888\/photo\/1","type":"photo","sizes":{"thumb":{"w":150,"h":150,"resize":"crop"},"small":{"w":340,"h":191,"resize":"fit"},"medium":{"w":600,"h":337,"resize":"fit"},"large":{"w":1024,"h":576,"resize":"fit"}}}]},"favorited":false,"retweeted":false,"possibly_sensitive":false,"possibly_sensitive_appealable":false,"lang":"en"}'
|
||||
http_version:
|
||||
recorded_at: Fri, 22 May 2015 23:57:30 GMT
|
||||
- request:
|
||||
method: head
|
||||
uri: http://pbs.twimg.com/media/B9rxY1qCcAAbeo0.jpg:orig
|
||||
body:
|
||||
encoding: US-ASCII
|
||||
string: ''
|
||||
headers:
|
||||
User-Agent:
|
||||
- crystal/2.80.0
|
||||
Accept:
|
||||
- "*/*"
|
||||
response:
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
headers:
|
||||
Cache-Control:
|
||||
- max-age=604800, must-revalidate
|
||||
Content-Md5:
|
||||
- owAkLGZeD7NZTChJ3z0/EA==
|
||||
Content-Type:
|
||||
- image/jpeg
|
||||
Last-Modified:
|
||||
- Fri, 13 Feb 2015 00:24:29 GMT
|
||||
Server:
|
||||
- tsa_a
|
||||
X-Connection-Hash:
|
||||
- ca604a6bf0ac6cf10bfa24318305b274
|
||||
X-Response-Time:
|
||||
- '94'
|
||||
Content-Length:
|
||||
- '56808'
|
||||
Accept-Ranges:
|
||||
- bytes
|
||||
Date:
|
||||
- Fri, 22 May 2015 23:57:30 GMT
|
||||
Via:
|
||||
- 1.1 varnish
|
||||
Age:
|
||||
- '0'
|
||||
Connection:
|
||||
- keep-alive
|
||||
X-Served-By:
|
||||
- cache-tw-sjc1-cr1-14-TWSJC1
|
||||
X-Cache:
|
||||
- MISS
|
||||
X-Cache-Hits:
|
||||
- '0'
|
||||
Expires:
|
||||
- Sat, 06 Jun 2015 23:57:30 GMT
|
||||
X-Content-Type-Options:
|
||||
- nosniff
|
||||
body:
|
||||
encoding: UTF-8
|
||||
string: ''
|
||||
http_version:
|
||||
recorded_at: Fri, 22 May 2015 23:57:31 GMT
|
||||
recorded_with: VCR 2.9.0
|
||||
@@ -35,6 +35,18 @@ class UploadsControllerTest < ActionController::TestCase
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
context "for a twitter post" do
|
||||
setup do
|
||||
VCR.use_cassette("upload-new-twitter", :record => :once) do
|
||||
get :new, {:url => "https://twitter.com/frappuccino/status/566030116182949888"}, {:user_id => @user.id}
|
||||
end
|
||||
end
|
||||
|
||||
should "render" do
|
||||
assert_response :success
|
||||
end
|
||||
end
|
||||
|
||||
context "for a post that has already been uploaded" do
|
||||
setup do
|
||||
@post = FactoryGirl.create(:post, :source => "aaa")
|
||||
|
||||
@@ -79,6 +79,11 @@ module Sources
|
||||
assert_contains(pixiv_links, /search\.php/)
|
||||
end
|
||||
|
||||
should "get the artist commentary" do
|
||||
assert_not_nil(@site.artist_commentary_title)
|
||||
assert_not_nil(@site.artist_commentary_desc)
|
||||
end
|
||||
|
||||
should "convert a page into a json representation" do
|
||||
assert_nothing_raised do
|
||||
@site.to_json
|
||||
|
||||
@@ -44,6 +44,10 @@ module Sources
|
||||
assert_equal([], @site.tags)
|
||||
end
|
||||
|
||||
should "get the artist commentary" do
|
||||
assert_not_nil(@site.artist_commentary_desc)
|
||||
end
|
||||
|
||||
should "convert a page into a json representation" do
|
||||
assert_nothing_raised do
|
||||
@site.to_json
|
||||
|
||||
@@ -217,6 +217,27 @@ class UploadTest < ActiveSupport::TestCase
|
||||
end
|
||||
end
|
||||
|
||||
context "with an artist commentary" do
|
||||
setup do
|
||||
@upload = FactoryGirl.create(:source_upload,
|
||||
:rating => "s",
|
||||
:uploader_ip_addr => "127.0.0.1",
|
||||
:tag_string => "hoge foo"
|
||||
)
|
||||
@upload.include_artist_commentary = "1"
|
||||
@upload.artist_commentary_title = ""
|
||||
@upload.artist_commentary_desc = "blah"
|
||||
end
|
||||
|
||||
should "create an artist commentary when processed" do
|
||||
VCR.use_cassette("upload-test-file", :record => :none) do
|
||||
assert_difference("ArtistCommentary.count") do
|
||||
@upload.process!
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
should "process completely for a downloaded image" do
|
||||
@upload = FactoryGirl.create(:source_upload,
|
||||
:rating => "s",
|
||||
|
||||
Reference in New Issue
Block a user