mirror of
https://github.com/internetee/registry.git
synced 2025-06-05 12:17:30 +02:00
changed cert filename format
This commit is contained in:
parent
b5b263f4b2
commit
f966f67fa7
2 changed files with 9 additions and 5 deletions
|
@ -61,11 +61,13 @@ module Admin
|
||||||
end
|
end
|
||||||
|
|
||||||
def download_csr
|
def download_csr
|
||||||
send_data @certificate.csr, filename: "#{@api_user.username}.csr.pem"
|
filename = "#{@api_user.username}_#{Date.today.strftime("%y%m%d")}_portal.csr.pem"
|
||||||
|
send_data @certificate.csr, filename: filename
|
||||||
end
|
end
|
||||||
|
|
||||||
def download_crt
|
def download_crt
|
||||||
send_data @certificate.crt, filename: "#{@api_user.username}.crt.pem"
|
filename = "#{@api_user.username}_#{Date.today.strftime("%y%m%d")}_portal.crt.pem"
|
||||||
|
send_data @certificate.crt, filename: filename
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -22,24 +22,26 @@ class AdminAreaCertificatesIntegrationTest < JavaScriptApplicationSystemTestCase
|
||||||
|
|
||||||
page.driver.browser.switch_to.alert.accept
|
page.driver.browser.switch_to.alert.accept
|
||||||
|
|
||||||
assert_text 'Record deleted'
|
assert_text 'Record deleted'
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_download_csr
|
def test_download_csr
|
||||||
|
filename = "test_bestnames_#{Date.today.strftime("%y%m%d")}_portal.csr.pem"
|
||||||
get download_csr_admin_api_user_certificate_path(api_user_id: @apiuser.id, id: @certificate.id)
|
get download_csr_admin_api_user_certificate_path(api_user_id: @apiuser.id, id: @certificate.id)
|
||||||
|
|
||||||
assert_response :ok
|
assert_response :ok
|
||||||
assert_equal 'application/octet-stream', response.headers['Content-Type']
|
assert_equal 'application/octet-stream', response.headers['Content-Type']
|
||||||
assert_equal "attachment; filename=\"test_bestnames.csr.pem\"; filename*=UTF-8''test_bestnames.csr.pem", response.headers['Content-Disposition']
|
assert_equal "attachment; filename=\"#{filename}\"; filename*=UTF-8''#{filename}", response.headers['Content-Disposition']
|
||||||
assert_not_empty response.body
|
assert_not_empty response.body
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_download_crt
|
def test_download_crt
|
||||||
|
filename = "test_bestnames_#{Date.today.strftime("%y%m%d")}_portal.crt.pem"
|
||||||
get download_crt_admin_api_user_certificate_path(api_user_id: @apiuser.id, id: @certificate.id)
|
get download_crt_admin_api_user_certificate_path(api_user_id: @apiuser.id, id: @certificate.id)
|
||||||
|
|
||||||
assert_response :ok
|
assert_response :ok
|
||||||
assert_equal 'application/octet-stream', response.headers['Content-Type']
|
assert_equal 'application/octet-stream', response.headers['Content-Type']
|
||||||
assert_equal "attachment; filename=\"test_bestnames.crt.pem\"; filename*=UTF-8''test_bestnames.crt.pem", response.headers['Content-Disposition']
|
assert_equal "attachment; filename=\"#{filename}\"; filename*=UTF-8''#{filename}", response.headers['Content-Disposition']
|
||||||
assert_not_empty response.body
|
assert_not_empty response.body
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue