summaryrefslogtreecommitdiff
path: root/users/test
diff options
context:
space:
mode:
Diffstat (limited to 'users/test')
-rw-r--r--users/test/integration/api/account_flow_test.rb5
-rw-r--r--users/test/unit/identity_test.rb4
2 files changed, 7 insertions, 2 deletions
diff --git a/users/test/integration/api/account_flow_test.rb b/users/test/integration/api/account_flow_test.rb
index 4c94389..93b6507 100644
--- a/users/test/integration/api/account_flow_test.rb
+++ b/users/test/integration/api/account_flow_test.rb
@@ -79,8 +79,13 @@ class AccountFlowTest < RackTest
test_public_key = 'asdlfkjslfdkjasd'
original_login = @user.login
new_login = 'zaph'
+ User.find_by_login(new_login).try(:destroy)
+ Identity.by_address.key(new_login + '@' + APP_CONFIG[:domain]).each do |identity|
+ identity.destroy
+ end
put "http://api.lvh.me:3000/1/users/" + @user.id + '.json', :user => {:public_key => test_public_key, :login => new_login}, :format => :json
@user.reload
+ assert last_response.successful?
assert_equal test_public_key, @user.public_key
assert_equal new_login, @user.login
# eventually probably want to remove most of this into a non-integration functional test
diff --git a/users/test/unit/identity_test.rb b/users/test/unit/identity_test.rb
index d20ad93..40b1296 100644
--- a/users/test/unit/identity_test.rb
+++ b/users/test/unit/identity_test.rb
@@ -57,13 +57,13 @@ class IdentityTest < ActiveSupport::TestCase
test "setting and getting pgp key" do
id = @user.identity
- id.keys[:pgp] = pgp_key_string
+ id.set_key(:pgp, pgp_key_string)
assert_equal pgp_key_string, id.keys[:pgp]
end
test "querying pgp key via couch" do
id = @user.identity
- id.keys[:pgp] = pgp_key_string
+ id.set_key(:pgp, pgp_key_string)
id.save
view = Identity.pgp_key_by_email.key(id.address)
assert_equal 1, view.rows.count