mirror of
https://github.com/neocities/neocities.git
synced 2025-04-25 01:32:36 +02:00
Update tests for screenshot worker url array
This commit is contained in:
parent
eb519d0bbf
commit
368d000551
2 changed files with 9 additions and 3 deletions
|
@ -16,7 +16,8 @@ proxy_ips:
|
|||
education_tag_whitelist:
|
||||
- mrteacher
|
||||
stop_forum_spam_api_key: testkey
|
||||
screenshots_url: http://screenshots:derp@screenshotssite.com
|
||||
screenshot_urls:
|
||||
- http://screenshots:derp@screenshotssite.com
|
||||
cache_control_ips:
|
||||
- 1.2.3.4
|
||||
- 4.5.6.7
|
||||
|
|
|
@ -4,10 +4,15 @@ describe ScreenshotWorker do
|
|||
|
||||
it 'saves a screenshot for a root html file' do
|
||||
['index.html', 'derpie/derp/index.html'].each do |path|
|
||||
uri = Addressable::URI.parse $config['screenshots_url']
|
||||
uri = Addressable::URI.parse $config['screenshot_urls'].sample
|
||||
site = Fabricate :site
|
||||
|
||||
stub_request(:get, "#{uri.scheme}://#{uri.host}/?url=#{site.uri}/#{path}&wait_time=#{ScreenshotWorker::PAGE_WAIT_TIME}").
|
||||
base_host = "#{uri.scheme}://#{uri.host}"
|
||||
if uri.port != 80 && uri.port != 443
|
||||
base_host += ":#{uri.port}"
|
||||
end
|
||||
|
||||
stub_request(:get, "#{base_host}/?url=#{site.uri}/#{path}&wait_time=#{ScreenshotWorker::PAGE_WAIT_TIME}").
|
||||
with(basic_auth: [uri.user, uri.password]).
|
||||
to_return(status: 200, headers: {}, body: File.read('tests/files/img/test.jpg'))
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue