def test_correct_opal_openssl_config(self):
        # Check that calling generateOpensslConfig() will return an appropriate
        # openssl configuration.
        upload = SigningUpload()
        text = upload.generateOpensslConfig('Opal', 'something-unique')

        cn_re = re.compile(r'\bCN\s*=\s*something-unique\b')

        self.assertIn('[ req ]', text)
        self.assertIsNotNone(cn_re.search(text))
        self.assertNotIn('extendedKeyUsage', text)
    def test_correct_kmod_openssl_config(self):
        # Check that calling generateOpensslConfig() will return an appropriate
        # openssl configuration.
        upload = SigningUpload()
        text = upload.generateOpensslConfig('Kmod', 'something-unique')

        cn_re = re.compile(r'\bCN\s*=\s*something-unique\b')
        eku_re = re.compile(r'\bextendedKeyUsage\s*=\s*'
                            r'codeSigning,1.3.6.1.4.1.2312.16.1.2\s*\b')

        self.assertIn('[ req ]', text)
        self.assertIsNotNone(cn_re.search(text))
        self.assertIsNotNone(eku_re.search(text))