def test_get_available_mechanisms(self): auth1 = Auth(None) auth2 = FakeAuthWithGetSecret(None) self.assertEqual([], auth1.get_available_mechanisms()) self.assertEqual([Plain, Login], auth1.get_available_mechanisms(True)) self.assertEqual([CramMd5], auth2.get_available_mechanisms()) self.assertEqual([CramMd5, Plain, Login], auth2.get_available_mechanisms(True))
def test_unimplemented_means_invalid(self): auth = Auth(None) with self.assertRaises(CredentialsInvalidError): auth.verify_secret('user', 'pass') with self.assertRaises(CredentialsInvalidError): auth.get_secret('user')
def test_str(self): auth = FakeAuthWithGetSecret(FakeSession(False)) self.assertEqual('CRAM-MD5', str(auth)) auth = Auth(FakeSession(True)) self.assertEqual('PLAIN LOGIN', str(auth))
def test_get_available_mechanisms(self): auth = Auth() assert_equal([CramMd5], auth.get_available_mechanisms()) assert_equal([CramMd5, Plain, Login], auth.get_available_mechanisms(True))
def test_get_available_mechanisms(self): auth = Auth() self.assertEqual([CramMd5], auth.get_available_mechanisms()) self.assertEqual([CramMd5, Plain, Login], auth.get_available_mechanisms(True))
def test_get_available_mechanisms(self): auth = Auth(None) self.assertEqual([CramMd5], auth.get_available_mechanisms()) self.assertEqual([Plain, Login, CramMd5], auth.get_available_mechanisms(True))