summaryrefslogtreecommitdiff
path: root/tests/helpers
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2014-12-15 16:06:27 -0800
committerelijah <elijah@riseup.net>2014-12-15 16:06:27 -0800
commitaedd6a57b5bf2a5d53cb19d181f90d78918ddf75 (patch)
treec3f4987c91911b375d09d5d9847cab5c435021d5 /tests/helpers
parent42ce1aa4fdeaa54058acbbd8530031ce2e516373 (diff)
bugfix: identities of test users must be also destroyed. closes #6550.
Diffstat (limited to 'tests/helpers')
-rw-r--r--tests/helpers/bonafide_helper.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/helpers/bonafide_helper.rb b/tests/helpers/bonafide_helper.rb
index d96b3977..faf8c1f4 100644
--- a/tests/helpers/bonafide_helper.rb
+++ b/tests/helpers/bonafide_helper.rb
@@ -75,12 +75,24 @@ class LeapTest
options = {:headers => {
"Authorization" => "Token token=\"#{user.session_token}\""
}}
+ params = {
+ :identities => 'destroy'
+ }
user.deleted = true
- delete(url, {}, options) do |body, response, error|
+ delete(url, params, options) do |body, response, error|
+ assert error.nil?, "Error deleting user: #{error}"
assert response.code.to_i == 200, "Unable to delete user: HTTP response from API should have code 200, was #{response.code} #{error} #{body}"
assert(response = JSON.parse(body), 'Delete response should be JSON')
assert(response["success"], 'Deleting user should be a success')
end
+ domain = property('domain.full_suffix')
+ identities_url = couchdb_url("/identities/_design/Identity/_view/by_address?key=%22#{user.username}@#{domain}%22")
+ get(identities_url) do |body, response, error|
+ assert error.nil?, "Error checking identities db: #{error}"
+ assert response.code.to_i == 200, "Unable to check that user identity was deleted: HTTP response from API should have code 200, was #{response.code} #{error} #{body}"
+ assert(response = JSON.parse(body), 'Couch response should be JSON')
+ assert response['rows'].empty?, "Identity should have been deleted for test user #{user.username} (id #{user.id}), but was not! Response was: #{body}."
+ end
end
end