Ejemplo n.º 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)
Ejemplo n.º 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')
                      ]))
Ejemplo n.º 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}))
Ejemplo n.º 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(),
        )
Ejemplo n.º 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)
Ejemplo n.º 6
0
 def selectCiphers(self, _):
     return [sslverify.OpenSSLCipher(u'sentinel')]