     [res] = yield request.putAsync { uri: getURL('/db/user/'+invalidUser.id), json: { name: 'A new name' }}
     expect(res.statusCode).toBe(200)
     expect(res.body.name).toBe('A new name')
+
+  it 'allows multiple anonymous users to have the same name, even with signed up users', utils.wrap ->
+    name = 'Bob'
+    yield utils.initUser({name}) # make an existing user
+
+    user1 = yield utils.becomeAnonymous()
+    [res] = yield request.putAsync { url: utils.getUrl("/db/user/#{user1.id}"), json: { name }}
+    expect(res.statusCode).toBe(200)
+
+    user2 = yield utils.becomeAnonymous()
+    [res] = yield request.putAsync { url: utils.getUrl("/db/user/#{user2.id}"), json: { name }}
+    expect(res.statusCode).toBe(200)
     
 
 describe 'PUT /db/user/-/become-student', ->


describe 'GET /db/user', ->

  it 'logs in as admin', (done) ->
    json = {
      username: 'admin@afc.com'
      password: '80yqxpb38j'
    }
    request.post { url: getURL('/auth/login'), json }, (error, response) ->
      expect(response.statusCode).toBe(200)
      done()

  it 'get schema', (done) ->
    request.get {uri: getURL(urlUser+'/schema')}, (err, res, body) ->

    expect(res.statusCode).toBe(200)
    expect(res.body.coursePrepaid._id).toBe(user.get('coursePrepaidID').toString())
    expect(res.body.coursePrepaid.startDate).toBe(Prepaid.DEFAULT_START_DATE)

  it 'looks up the user by id', utils.wrap ->
    user = yield utils.initUser()
    yield utils.becomeAnonymous()
    url = utils.getURL("/db/user/#{user.id}")
    [res] = yield request.getAsync({url, json: true})
    expect(res.statusCode).toBe(200)
    expect(res.body.name).toBe(user.get('name'))  # Anyone should be served the username.
    expect(res.body.email).toBeUndefined()  # Shouldn't be available to anonymous users.
    expect(res.body.passwordHash).toBeUndefined()


describe 'DELETE /db/user/:handle', ->
  it 'can delete a user', utils.wrap ->
