Example #1
0
 def test_create_with_passphrase(self):
     cert, key = generate_cert_and_pkey(as_string=True, passphrase='pass')
     form = APNServiceForm({
         'name': 'test',
         'hostname': 'localhost',
         'certificate': cert,
         'private_key': key,
         'passphrase': 'pass'
     })
     self.assertTrue(form.is_valid())
Example #2
0
 def test_create_with_invalid_passphrase(self):
     cert, key = generate_cert_and_pkey(as_string=True, passphrase='correct')
     form = APNServiceForm({'name': 'test', 'hostname': 'localhost', 'certificate': cert, 'private_key': key, 'passphrase': 'incorrect'})
     self.assertFalse(form.is_valid())
     self.assertTrue('passphrase' in form.errors)