2020-02-06 16:11:17 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'test_helper'
|
|
|
|
|
|
|
|
module Api
|
|
|
|
module V1
|
|
|
|
class CSPReportsControllerTest < ActionDispatch::IntegrationTest
|
|
|
|
test 'se puede enviar un reporte' do
|
2020-09-29 21:22:28 +00:00
|
|
|
skip
|
|
|
|
|
2020-02-06 16:11:17 +00:00
|
|
|
post v1_csp_reports_url,
|
2021-04-15 14:34:42 +00:00
|
|
|
host: "api.#{Site.domain}",
|
2020-02-06 16:11:17 +00:00
|
|
|
params: {
|
|
|
|
'csp-report': {
|
|
|
|
'document-uri': 'http://example.com/signup.html',
|
2021-04-15 14:34:42 +00:00
|
|
|
referrer: '',
|
2020-02-06 16:11:17 +00:00
|
|
|
'blocked-uri': 'http://example.com/css/style.css',
|
|
|
|
'violated-directive': 'style-src cdn.example.com',
|
|
|
|
'original-policy': "default-src 'none'; style-src cdn.example.com; report-uri /_/csp-reports"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
assert_equal 201, response.status
|
|
|
|
assert_equal 1, CspReport.all.count
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|