blob: 74d439a8d4b976118f9c48d97d4bbe7cb9314c69 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
require 'test_helper'
class CertTest < ApiIntegrationTest
test "retrieve eip cert" do
login
get '/1/cert', {}, RACK_ENV
assert_text_response
assert_response_includes "BEGIN RSA PRIVATE KEY"
assert_response_includes "END RSA PRIVATE KEY"
assert_response_includes "BEGIN CERTIFICATE"
assert_response_includes "END CERTIFICATE"
end
test "fetching certs requires login by default" do
get '/1/cert', {}, RACK_ENV
assert_json_response error: I18n.t(:not_authorized)
end
test "retrieve anonymous eip cert" do
with_config allow_anonymous_certs: true do
get '/1/cert', {}, RACK_ENV
assert_text_response
assert_response_includes "BEGIN RSA PRIVATE KEY"
assert_response_includes "END RSA PRIVATE KEY"
assert_response_includes "BEGIN CERTIFICATE"
assert_response_includes "END CERTIFICATE"
end
end
end
|