summaryrefslogtreecommitdiff
path: root/test/integration
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2014-05-15 16:29:49 +0200
committerAzul <azul@leap.se>2014-05-19 14:24:47 +0200
commit17b67aeda81dee2273ce1161ac7292a328c3efaa (patch)
tree8c7da1f418c61c8159cb761c6c2a081d521031fd /test/integration
parent71dcf3f4e5d423b78b47f675297fc98b28ef3442 (diff)
store cert fingerprint with main user identity
Diffstat (limited to 'test/integration')
-rw-r--r--test/integration/api/smtp_cert_test.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/test/integration/api/smtp_cert_test.rb b/test/integration/api/smtp_cert_test.rb
index a579d93..4f0f4a6 100644
--- a/test/integration/api/smtp_cert_test.rb
+++ b/test/integration/api/smtp_cert_test.rb
@@ -14,7 +14,7 @@ class SmtpCertTest < ApiIntegrationTest
assert_response_includes "END CERTIFICATE"
end
- test "key matches the cert" do
+ test "cert and key" do
@user = FactoryGirl.create :user, effective_service_level_code: 2
login
get '/1/smtp_cert', {}, RACK_ENV
@@ -22,17 +22,17 @@ class SmtpCertTest < ApiIntegrationTest
cert = OpenSSL::X509::Certificate.new(get_response.body)
key = OpenSSL::PKey::RSA.new(get_response.body)
assert cert.check_private_key(key)
+ prefix = "/CN=#{@user.email_address}"
+ assert_equal prefix, cert.subject.to_s.slice(0,prefix.size)
end
- # we'll store the fingerprint later.
- test "fingerprint matches" do
+ test "fingerprint is stored with identity" do
@user = FactoryGirl.create :user, effective_service_level_code: 2
login
get '/1/smtp_cert', {}, RACK_ENV
assert_text_response
cert = OpenSSL::X509::Certificate.new(get_response.body)
fingerprint = OpenSSL::Digest::SHA1.hexdigest(cert.to_der).scan(/../).join(':')
- skip "we're not storing the fingerprints yet"
assert_equal fingerprint, @user.identity.cert_fingerprints.last
end