summaryrefslogtreecommitdiff
path: root/users/test
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2013-07-19 09:50:02 +0200
committerAzul <azul@leap.se>2013-07-24 10:55:51 +0200
commitdcaf6232dbd1131cdbd12ac5c2ef997979fd01ff (patch)
tree7b39b0bb5ab27989ee5d90ca29bd73ef3f47e203 /users/test
parent495c97fbf400ed44a1e64692f2c04d2155a326e7 (diff)
add keys to identity
Diffstat (limited to 'users/test')
-rw-r--r--users/test/unit/identity_test.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/users/test/unit/identity_test.rb b/users/test/unit/identity_test.rb
index 4ebd72e..6b0a6b1 100644
--- a/users/test/unit/identity_test.rb
+++ b/users/test/unit/identity_test.rb
@@ -55,7 +55,22 @@ class IdentityTest < ActiveSupport::TestCase
other_user.destroy
end
+ test "setting and getting pgp key" do
+ id = @user.build_identity
+ id.keys[:pgp] = pgp_key_string
+ assert_equal pgp_key_string, id.keys[:pgp]
+ end
+ test "querying pgp key via couch" do
+ id = @user.build_identity
+ id.keys[:pgp] = pgp_key_string
+ id.save
+ view = Identity.pgp_key_by_email.key(id.address)
+ assert_equal 1, view.rows.count
+ assert result = view.rows.first
+ assert_equal id.address, result["key"]
+ assert_equal id.keys[:pgp], result["value"]
+ end
def alias_name
@alias_name ||= Faker::Internet.user_name
@@ -64,4 +79,8 @@ class IdentityTest < ActiveSupport::TestCase
def forward_address
@forward_address ||= Faker::Internet.email
end
+
+ def pgp_key_string
+ @pgp_key ||= "DUMMY PGP KEY ... "+SecureRandom.base64(4096)
+ end
end