def test_eqSameClass(self): """ Equal type and C{fullName} means that the objects are equal. """ cipher1 = sslverify.OpenSSLCipher(self.cipherName) cipher2 = sslverify.OpenSSLCipher(self.cipherName) self.assertEqual(cipher1, cipher2)
def test_selectReturnsOnlyFromAvailable(self): """ Select only returns a cross section of what is available and what is desirable. """ ac = sslverify.OpenSSLAcceptableCiphers([ sslverify.OpenSSLCipher('A'), sslverify.OpenSSLCipher('B'), ]) self.assertEqual([sslverify.OpenSSLCipher('B')], ac.selectCiphers([ sslverify.OpenSSLCipher('B'), sslverify.OpenSSLCipher('C') ]))
def test_repr(self): """ C{repr(cipher)} returns a valid constructor call. """ cipher = sslverify.OpenSSLCipher(self.cipherName) self.assertEqual( cipher, eval(repr(cipher), {'OpenSSLCipher': sslverify.OpenSSLCipher}))
def test_eqSameNameDifferentType(self): """ If ciphers have the same name but different types, they're still different. """ class DifferentCipher(object): fullName = self.cipherName self.assertNotEqual( sslverify.OpenSSLCipher(self.cipherName), DifferentCipher(), )
def test_constructorSetsFullName(self): """ The first argument passed to the constructor becomes the full name. """ self.assertEqual(self.cipherName, sslverify.OpenSSLCipher(self.cipherName).fullName)
def selectCiphers(self, _): return [sslverify.OpenSSLCipher(u'sentinel')]