DEV: stub youtube embed requests (#12637)

* DEV: stub youtube embed requests

* DEV: Ignore redirects on youtube.com when oneboxing
This commit is contained in:
jbrw 2021-04-07 13:32:27 -04:00 committed by GitHub
parent 817b6c24c8
commit 50252d803e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -23,7 +23,7 @@ module Oneboxer
end end
def self.ignore_redirects def self.ignore_redirects
@ignore_redirects ||= ['http://www.dropbox.com', 'http://store.steampowered.com', 'http://vimeo.com', Discourse.base_url] @ignore_redirects ||= ['http://www.dropbox.com', 'http://store.steampowered.com', 'http://vimeo.com', 'https://www.youtube.com', Discourse.base_url]
end end
def self.amazon_domains def self.amazon_domains

View File

@ -207,6 +207,7 @@ describe Oneboxer do
before do before do
stub_request(:any, "https://www.youtube.com/watch?v=dQw4w9WgXcQ").to_return(status: 200, body: html) stub_request(:any, "https://www.youtube.com/watch?v=dQw4w9WgXcQ").to_return(status: 200, body: html)
stub_request(:any, "https://www.youtube.com/embed/dQw4w9WgXcQ").to_return(status: 403, body: nil)
end end
it "allows restricting engines based on the allowed_onebox_iframes setting" do it "allows restricting engines based on the allowed_onebox_iframes setting" do