'L{basic.BasicCredentialFactory.decode} turns a base64-encoded response
into a L{UsernamePassword} object with a password which reflects the
one which was encoded in the response.'

def test_usernamePassword(self):

    response = b64encode(''.join([self.username, ':', self.password]))
    creds = self.credentialFactory.decode(response, self.request)
    self.assertTrue(IUsernamePassword.providedBy(creds))
    self.assertTrue(creds.checkPassword(self.password))
    self.assertFalse(creds.checkPassword((self.password + 'wrong')))
