'L{DirdbmDatabase.requestAvatarId} raises L{UnauthorizedLogin} if
supplied with invalid user credentials.
When called with valid credentials, L{requestAvatarId} returns
the username associated with the supplied credentials.'

def test_requestAvatarId(self):

    self.D.addUser('user', 'password')
    database = self.D.getCredentialsCheckers()[0]
    creds = cred.credentials.UsernamePassword('user', 'wrong    password')
    self.assertRaises(cred.error.UnauthorizedLogin, database.requestAvatarId, creds)
    creds = cred.credentials.UsernamePassword('user', 'password')
    self.assertEqual(database.requestAvatarId(creds), 'user')
