summaryrefslogtreecommitdiff
path: root/users/test/unit/user_test.rb
diff options
context:
space:
mode:
authorjessib <jessib@riseup.net>2013-08-27 12:18:35 -0700
committerjessib <jessib@riseup.net>2013-08-27 12:18:35 -0700
commitdc41ae0a3fb0a137e716d8ec63084b0ec3a7299b (patch)
treec09fef161f105e7c03c35d1edcb2d257144cb97d /users/test/unit/user_test.rb
parenta87c750d1f12f15272beb117f8ee12ab711cc6d1 (diff)
parente481b8cbc05a858674a59ef36d695973622f6b3a (diff)
Merge branch 'master' into billing_with_tests
Diffstat (limited to 'users/test/unit/user_test.rb')
-rw-r--r--users/test/unit/user_test.rb23
1 files changed, 15 insertions, 8 deletions
diff --git a/users/test/unit/user_test.rb b/users/test/unit/user_test.rb
index c8c837b..89ee749 100644
--- a/users/test/unit/user_test.rb
+++ b/users/test/unit/user_test.rb
@@ -56,23 +56,30 @@ class UserTest < ActiveSupport::TestCase
other_user.destroy
end
- test "login needs to be different from other peoples email aliases" do
+ test "login needs to be unique amongst aliases" do
other_user = FactoryGirl.create :user
- other_user.email_aliases.build :email => @user.login
- other_user.save
+ Identity.create_for other_user, address: @user.login
assert !@user.valid?
other_user.destroy
end
+ test "deprecated public key api still works" do
+ key = SecureRandom.base64(4096)
+ @user.public_key = key
+ assert_equal key, @user.public_key
+ end
+
test "pgp key view" do
- @user.public_key = SecureRandom.base64(4096)
- @user.save
+ key = SecureRandom.base64(4096)
+ identity = Identity.create_for @user
+ identity.set_key('pgp', key)
+ identity.save
- view = User.pgp_key_by_handle.key(@user.login)
+ view = Identity.pgp_key_by_email.key(@user.email_address)
assert_equal 1, view.rows.count
assert result = view.rows.first
- assert_equal @user.login, result["key"]
- assert_equal @user.public_key, result["value"]
+ assert_equal @user.email_address, result["key"]
+ assert_equal key, result["value"]
end
end