summaryrefslogtreecommitdiff
path: root/test/unit/identity_test.rb
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2016-02-10 10:56:57 -0800
committerelijah <elijah@riseup.net>2016-02-10 10:56:57 -0800
commit49d3e9df74685fe17a2abbbabdd17014f2371065 (patch)
tree41dc44c41659e2f970b84ac2fe0da8152422efee /test/unit/identity_test.rb
parent0ba489bdb01bb2f0536d2603bd389d448712e336 (diff)
allow user accounts to be re-enabled, and for associated identities to also get re-enabled.
Diffstat (limited to 'test/unit/identity_test.rb')
-rw-r--r--test/unit/identity_test.rb29
1 files changed, 17 insertions, 12 deletions
diff --git a/test/unit/identity_test.rb b/test/unit/identity_test.rb
index 1f93109..9d4bc90 100644
--- a/test/unit/identity_test.rb
+++ b/test/unit/identity_test.rb
@@ -110,33 +110,38 @@ class IdentityTest < ActiveSupport::TestCase
assert @id.errors.messages[:destination].include? "needs to be a valid email address"
end
- test "disabled identity" do
+ test "disable identity" do
@id = Identity.for(@user)
- @id.disable
+ @id.disable!
+ assert !@id.enabled?
+ assert @id.valid?
+ end
+
+ test "orphan identity" do
+ @id = Identity.for(@user)
+ @id.orphan!
assert_equal @user.email_address, @id.address
assert_equal nil, @id.destination
assert_equal nil, @id.user
- assert !@id.enabled?
+ assert @id.orphaned?
assert @id.valid?
end
- test "disabled identity blocks handle" do
+ test "orphaned identity blocks handle" do
@id = Identity.for(@user)
- @id.disable
- @id.save
+ @id.orphan!
other_user = find_record :user
taken = Identity.build_for other_user, address: @id.address
assert !taken.valid?
assert_equal ["has already been taken"], taken.errors[:address]
end
- test "destroy all disabled identities" do
+ test "destroy all orphaned identities" do
@id = Identity.for(@user)
- @id.disable
- @id.save
- assert Identity.disabled.count > 0
- Identity.destroy_all_disabled
- assert_equal 0, Identity.disabled.count
+ @id.orphan!
+ assert Identity.orphaned.count > 0
+ Identity.destroy_all_orphaned
+ assert_equal 0, Identity.orphaned.count
end
test "store cert fingerprint" do