user = users[Math.floor(Math.random()*users.length)];
username = user.name.split(/\//).pop()
userHoodie = new Hoodie hoodie.baseUrl.replace(/\bapi\./, "#{user.ownerHash}-#{hoodie.uuid(5)}.api.")
userHoodie.account.signIn( username ).then -> return userHoodie
else
@addTestUser keepSignedIn : true
removeAllTestUsers: ->
@hoodie.rejectWith(error: "not yet implemented")
getTotal : ->
@findAll().pipe (users) -> users.length
search : (query) ->
path = "/_all_docs?include_docs=true"
path = "#{path}&startkey=\"org.couchdb.user:user/#{query}\"&endkey=\"org.couchdb.user:user/#{query}|\""
@request("GET", path)
.pipe(@_mapDocsFromFindAll).pipe(@_parseAllFromRemote)
#
request : (type, path, options = {}) ->
path = "/#{encodeURIComponent @name}#{path}" if @name
options.contentType or= 'application/json'
if type is 'POST' or type is 'PUT'
options.dataType or= 'json'
options.processData or= false
options.data = JSON.stringify options.data
@admin.request type, path, options
HoodieAdmin.Users