summaryrefslogtreecommitdiff
path: root/test/unit/account_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit/account_test.rb')
-rw-r--r--test/unit/account_test.rb20
1 files changed, 15 insertions, 5 deletions
diff --git a/test/unit/account_test.rb b/test/unit/account_test.rb
index 6b814b6..7c26d5c 100644
--- a/test/unit/account_test.rb
+++ b/test/unit/account_test.rb
@@ -1,4 +1,4 @@
-require 'test_helper'
+require_relative '../test_helper'
class AccountTest < ActiveSupport::TestCase
@@ -23,10 +23,10 @@ class AccountTest < ActiveSupport::TestCase
test "create a new account" do
with_config invite_required: false do
- user = Account.create(FactoryGirl.attributes_for(:user))
- assert user.valid?, "unexpected errors: #{user.errors.inspect}"
- assert user.persisted?
- user.account.destroy
+ user = Account.create(FactoryGirl.attributes_for(:user))
+ assert user.valid?, "unexpected errors: #{user.errors.inspect}"
+ assert user.persisted?
+ user.account.destroy
end
end
@@ -80,4 +80,14 @@ class AccountTest < ActiveSupport::TestCase
assert_equal 0, user_code.invite_count
end
+
+ test "disabled accounts have no cert fingerprints" do
+ user = Account.create(FactoryGirl.attributes_for(:user))
+ cert = stub(expiry: 1.month.from_now, fingerprint: SecureRandom.hex)
+ user.identity.register_cert cert
+ user.identity.save
+ assert_equal cert.fingerprint, Identity.for(user).cert_fingerprints.keys.first
+ user.account.disable
+ assert_equal({}, Identity.for(user).cert_fingerprints)
+ end
end