summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2015-01-28 12:32:15 -0800
committerelijah <elijah@riseup.net>2015-01-28 12:32:15 -0800
commiteebe08aba43302b080c7b534a746f0f30359f370 (patch)
tree40d20aa9db55319328d70126635a8d84b542828a /test
parent42ba688eabcdb428e0ce230175b72c357bea9cdb (diff)
client certificates: allow for time units to be specified in client_cert_lifespan config option.
Diffstat (limited to 'test')
-rw-r--r--test/integration/api/smtp_cert_test.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/test/integration/api/smtp_cert_test.rb b/test/integration/api/smtp_cert_test.rb
index b1bfd43..2f50ef3 100644
--- a/test/integration/api/smtp_cert_test.rb
+++ b/test/integration/api/smtp_cert_test.rb
@@ -33,7 +33,8 @@ class SmtpCertTest < ApiIntegrationTest
assert_text_response
cert = OpenSSL::X509::Certificate.new(get_response.body)
fingerprint = OpenSSL::Digest::SHA1.hexdigest(cert.to_der).scan(/../).join(':')
- expiry = APP_CONFIG[:client_cert_lifespan].months.from_now.utc.midnight
+ number, unit = APP_CONFIG[:client_cert_lifespan].split(' ')
+ expiry = Time.now.utc.at_midnight.advance(unit.to_sym => number.to_i)
expiry_string = expiry.to_date.to_s
fingerprints = {fingerprint => expiry_string}
assert_equal fingerprints, @user.reload.identity.cert_fingerprints