Example #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)
Example #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)
Example #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)
Example #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)
Example #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)
Example #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)
Example #7
0
 def test_valid(self):
     try:
         crypto.validate_key(utilities.make_key())
     except GPGProblem as e:
         raise AssertionError(e)
Example #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)
Example #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)
Example #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)
Example #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)
Example #12
0
 def test_valid(self):
     try:
         crypto.validate_key(utilities.make_key())
     except GPGProblem as e:
         raise AssertionError(e)