':py:obj:`dump_privatekey` writes an encrypted PEM when given a passphrase.'

def test_dump_privatekey_passphrase(self):

    passphrase = b('foo')
    key = load_privatekey(FILETYPE_PEM, cleartextPrivateKeyPEM)
    pem = dump_privatekey(FILETYPE_PEM, key, GOOD_CIPHER, passphrase)
    self.assertTrue(isinstance(pem, binary_type))
    loadedKey = load_privatekey(FILETYPE_PEM, pem, passphrase)
    self.assertTrue(isinstance(loadedKey, PKeyType))
    self.assertEqual(loadedKey.type(), key.type())
    self.assertEqual(loadedKey.bits(), key.bits())
