Esempio n. 1
0
 def test_sign_no_check(self):
     try:
         crypto.validate_key(utilities.make_key(can_sign=False))
     except GPGProblem as e:
         raise AssertionError(e)
Esempio n. 2
0
    def test_encrypt(self):
        with self.assertRaises(GPGProblem) as caught:
            crypto.validate_key(utilities.make_key(can_encrypt=False), encrypt=True)

        self.assertEqual(caught.exception.code, GPGCode.KEY_CANNOT_ENCRYPT)
Esempio n. 3
0
    def test_sign(self):
        with self.assertRaises(GPGProblem) as caught:
            crypto.validate_key(utilities.make_key(can_sign=False), sign=True)

        self.assertEqual(caught.exception.code, GPGCode.KEY_CANNOT_SIGN)
Esempio n. 4
0
    def test_expired(self):
        with self.assertRaises(GPGProblem) as caught:
            crypto.validate_key(utilities.make_key(expired=True))

        self.assertEqual(caught.exception.code, GPGCode.KEY_EXPIRED)
Esempio n. 5
0
    def test_invalid(self):
        with self.assertRaises(GPGProblem) as caught:
            crypto.validate_key(utilities.make_key(invalid=True))

        self.assertEqual(caught.exception.code, GPGCode.KEY_INVALID)
Esempio n. 6
0
 def test_sign_no_check(self):
     try:
         crypto.validate_key(utilities.make_key(can_sign=False))
     except GPGProblem as e:
         raise AssertionError(e)
Esempio n. 7
0
 def test_valid(self):
     try:
         crypto.validate_key(utilities.make_key())
     except GPGProblem as e:
         raise AssertionError(e)
Esempio n. 8
0
    def test_sign(self):
        with self.assertRaises(GPGProblem) as caught:
            crypto.validate_key(utilities.make_key(can_sign=False), sign=True)

        self.assertEqual(caught.exception.code, GPGCode.KEY_CANNOT_SIGN)
Esempio n. 9
0
    def test_encrypt(self):
        with self.assertRaises(GPGProblem) as caught:
            crypto.validate_key(utilities.make_key(can_encrypt=False),
                                encrypt=True)

        self.assertEqual(caught.exception.code, GPGCode.KEY_CANNOT_ENCRYPT)
Esempio n. 10
0
    def test_invalid(self):
        with self.assertRaises(GPGProblem) as caught:
            crypto.validate_key(utilities.make_key(invalid=True))

        self.assertEqual(caught.exception.code, GPGCode.KEY_INVALID)
Esempio n. 11
0
    def test_expired(self):
        with self.assertRaises(GPGProblem) as caught:
            crypto.validate_key(utilities.make_key(expired=True))

        self.assertEqual(caught.exception.code, GPGCode.KEY_EXPIRED)
Esempio n. 12
0
 def test_valid(self):
     try:
         crypto.validate_key(utilities.make_key())
     except GPGProblem as e:
         raise AssertionError(e)