'Two different correct login attempts can be made on the same root
object at the same time and produce two different resulting avatars.'

def test_concurrentLogin(self):

    self.portal.registerChecker(checkers.InMemoryUsernamePasswordDatabaseDontUse(foo='bar', baz='quux'))
    firstLogin = self.clientFactory.login(credentials.UsernamePassword('foo', 'bar'), 'BRAINS!')
    secondLogin = self.clientFactory.login(credentials.UsernamePassword('baz', 'quux'), 'BRAINS!')
    d = gatherResults([firstLogin, secondLogin])
    def cbLoggedIn(result):
        (first, second) = result
        return gatherResults([first.callRemote('getAvatarId'), second.callRemote('getAvatarId')])
    d.addCallback(cbLoggedIn)
    def cbAvatarIds(x):
        (first, second) = x
        self.assertEqual(first, 'foo')
        self.assertEqual(second, 'baz')
    d.addCallback(cbAvatarIds)
    self.establishClientAndServer()
    self.pump.flush()
    return d
