summaryrefslogtreecommitdiff
path: root/test/integration/api/cert_test.rb
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2014-05-15 10:40:21 +0200
committerAzul <azul@leap.se>2014-05-19 14:24:47 +0200
commit1241cb8f13e6d0752b67521e8385b62d7fbcc882 (patch)
tree0fbec07bd9f22e052840df93a927265bdb073542 /test/integration/api/cert_test.rb
parente94b9471c0bc30cd6a1a5bf5b6b22b746d242e31 (diff)
basic integration test for cert API
Diffstat (limited to 'test/integration/api/cert_test.rb')
-rw-r--r--test/integration/api/cert_test.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/integration/api/cert_test.rb b/test/integration/api/cert_test.rb
new file mode 100644
index 0000000..74d439a
--- /dev/null
+++ b/test/integration/api/cert_test.rb
@@ -0,0 +1,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