예제 #1
0
 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)
예제 #2
0
 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')
                      ]))
예제 #3
0
 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}))
예제 #4
0
    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(),
        )
예제 #5
0
 def test_constructorSetsFullName(self):
     """
     The first argument passed to the constructor becomes the full name.
     """
     self.assertEqual(self.cipherName,
                      sslverify.OpenSSLCipher(self.cipherName).fullName)
예제 #6
0
 def selectCiphers(self, _):
     return [sslverify.OpenSSLCipher(u'sentinel')]