':py:obj:`dump_certificate_request` writes a PEM, DER, and text.'

def test_dump_certificate_request(self):

    req = load_certificate_request(FILETYPE_PEM, cleartextCertificateRequestPEM)
    dumped_pem = dump_certificate_request(FILETYPE_PEM, req)
    self.assertEqual(dumped_pem, cleartextCertificateRequestPEM)
    dumped_der = dump_certificate_request(FILETYPE_ASN1, req)
    good_der = _runopenssl(dumped_pem, 'req', '-outform', 'DER')
    self.assertEqual(dumped_der, good_der)
    req2 = load_certificate_request(FILETYPE_ASN1, dumped_der)
    dumped_pem2 = dump_certificate_request(FILETYPE_PEM, req2)
    self.assertEqual(dumped_pem2, cleartextCertificateRequestPEM)
    dumped_text = dump_certificate_request(FILETYPE_TEXT, req)
    good_text = _runopenssl(dumped_pem, 'req', '-noout', '-text')
    self.assertEqual(dumped_text, good_text)
    self.assertRaises(ValueError, dump_certificate_request, 100, req)
