def _setup_certificates(self, backend): # Set up the SSL certificates. if backend.different("ssl-cert-path", "ssl-cert-contents", "ssl-key-contents"): config = backend.config utils.save_or_create_certificates( config["ssl-cert-path"], config.get("ssl-cert-contents"), config.get("ssl-key-contents") )
def install(self, backend): utils.install_builtin_server() if backend.different("ssl-cert-path", "ssl-cert-contents", "ssl-key-contents"): config = backend.config utils.save_or_create_certificates( config["ssl-cert-path"], config.get("ssl-cert-contents"), config.get("ssl-key-contents") )
def install(self, backend): utils.install_builtin_server() if backend.different( 'ssl-cert-path', 'ssl-cert-contents', 'ssl-key-contents'): config = backend.config utils.save_or_create_certificates( config['ssl-cert-path'], config.get('ssl-cert-contents'), config.get('ssl-key-contents'))
def test_pem_file(self): # Ensure the pem file is created concatenating the key and cert files. save_or_create_certificates(self.cert_path, "Certificate", "Key") pem_file = os.path.join(self.cert_path, JUJU_PEM) self.assertEqual("KeyCertificate", open(pem_file).read())
def test_provided_certificates(self): # Ensure files are correctly saved if their contents are provided. save_or_create_certificates(self.cert_path, "mycert", "mykey") self.assertIn("mycert", open(self.cert_file).read()) self.assertIn("mykey", open(self.key_file).read())
def test_generation(self): # Ensure certificates are correctly generated. save_or_create_certificates(self.cert_path, "some ignored contents", None) self.assertIn("CERTIFICATE", open(self.cert_file).read()) self.assertIn("PRIVATE KEY", open(self.key_file).read())
def test_pem_file(self): # Ensure the pem file is created concatenating the key and cert files. save_or_create_certificates(self.cert_path, 'Certificate', 'Key') pem_file = os.path.join(self.cert_path, JUJU_PEM) self.assertEqual('KeyCertificate', open(pem_file).read())
def test_provided_certificates(self): # Ensure files are correctly saved if their contents are provided. save_or_create_certificates(self.cert_path, 'mycert', 'mykey') self.assertIn('mycert', open(self.cert_file).read()) self.assertIn('mykey', open(self.key_file).read())
def test_generation(self): # Ensure certificates are correctly generated. save_or_create_certificates( self.cert_path, 'some ignored contents', None) self.assertIn('CERTIFICATE', open(self.cert_file).read()) self.assertIn('PRIVATE KEY', open(self.key_file).read())