def test_post(self): n = 'csr' valid_setup = test_tls.get_valid_setup() yield set_init_params(valid_setup) yield https.PrivKeyFileRes.create_file(1, valid_setup['key']) State.tenant_cache[1].hostname = 'notreal.ns.com' d = { 'country': 'it', 'province': 'regione', 'city': 'citta', 'company': 'azienda', 'department': 'reparto', 'email': 'indrizzio@email', } body = {'name': 'csr', 'content': d} handler = self.request(body, role='admin') yield handler.post(n) response = yield handler.get(n) pem_csr = crypto.load_certificate_request(SSL.FILETYPE_PEM, response) comps = pem_csr.get_subject().get_components() self.assertIn((b'CN', b'notreal.ns.com'), comps) self.assertIn((b'C', b'IT'), comps) self.assertIn((b'L', b'citta'), comps)
def test_all_methods(self): valid_setup = test_tls.get_valid_setup() yield set_init_params(valid_setup['dh_params']) yield https.PrivKeyFileRes.create_file(valid_setup['key']) yield https.CertFileRes.create_file(valid_setup['cert']) yield https.ChainFileRes.create_file(valid_setup['chain']) handler = self.request(role='admin') response = yield handler.get() self.assertTrue(len(response['status']['msg']) > 0) # Config is ready to go. So launch the subprocesses. yield handler.post() response = yield handler.get() self.assertTrue(response['enabled']) self.test_reactor.pump([50]) # TODO improve resilience of shutdown. The child processes will complain # loudly as they die. yield handler.put() response = yield handler.get() self.assertFalse(response['enabled'])
def _setUp(self, session): valid_setup = test_tls.get_valid_setup() config.db_set_config_variable(session, 1, 'https_cert', valid_setup['cert']) config.db_set_config_variable(session, 1, 'https_enabled', True) db_refresh_memory_variables(session)
def _setUp(self, store): valid_setup = test_tls.get_valid_setup() prv_fact = PrivateFactory(store) prv_fact.set_val(u'https_cert', valid_setup['cert']) prv_fact.set_val(u'https_enabled', True) db_refresh_memory_variables(store)
def _setUp(self, session): valid_setup = test_tls.get_valid_setup() config = ConfigFactory(session, 1, 'node') config.set_val(u'https_cert', valid_setup['cert']) config.set_val(u'https_enabled', True) db_refresh_memory_variables(session)
def test_post(self): hostname = 'gl.dl.localhost.com' State.tenant_cache[1].hostname = hostname valid_setup = test_tls.get_valid_setup() yield https.PrivKeyFileRes.create_file(1, valid_setup['key']) handler = self.request(role='admin') resp = yield handler.post() current_le_tos = 'https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf' self.assertEqual(resp['terms_of_service'], current_le_tos)
def test_post(self): hostname = 'gl.dl.localhost.com' GLSettings.memory_copy.hostname = hostname valid_setup = test_tls.get_valid_setup() yield https.PrivKeyFileRes.create_file(valid_setup['key']) handler = self.request(role='admin') resp = yield handler.post() current_le_tos = 'https://letsencrypt.org/documents/LE-SA-v1.1.1-August-1-2016.pdf' self.assertEqual(resp['terms_of_service'], current_le_tos)
def test_all_methods(self): valid_setup = test_tls.get_valid_setup() yield set_init_params(valid_setup) yield https.PrivKeyFileRes.create_file(1, valid_setup['key']) yield https.CertFileRes.create_file(1, valid_setup['cert']) yield https.ChainFileRes.create_file(1, valid_setup['chain']) handler = self.request(role='admin') yield handler.post() response = yield handler.get() self.assertTrue(response['enabled']) self.test_reactor.pump([50]) yield handler.put() response = yield handler.get() self.assertFalse(response['enabled'])
def test_all_methods(self): valid_setup = test_tls.get_valid_setup() yield set_init_params(valid_setup) yield https.PrivKeyFileRes.create_file(1, valid_setup['key']) yield https.CertFileRes.create_file(1, valid_setup['cert']) yield https.ChainFileRes.create_file(1, valid_setup['chain']) handler = self.request(role='admin') response = yield handler.get() self.assertTrue(len(response['status']['msg']) > 0) # Config is ready to go. So launch the subprocesses. yield handler.post() response = yield handler.get() self.assertTrue(response['enabled']) self.test_reactor.pump([50]) yield handler.put() response = yield handler.get() self.assertFalse(response['enabled'])
def test_put(self): valid_setup = test_tls.get_valid_setup() yield https.AcmeAccntKeyRes.create_file(1) yield https.AcmeAccntKeyRes.save_accnt_uri(1, 'http://*****:*****@email', } } handler = self.request(body, role='admin') yield self.assertFailure(handler.put(), ConnectionError)
def setUp(self): self.valid_setup = test_tls.get_valid_setup() yield super(TestFileHandler, self).setUp() yield set_init_params(self.valid_setup)
def setUp(self): yield super(TestFileHandler, self).setUp() self.valid_setup = test_tls.get_valid_setup() yield set_dh_params(self.valid_setup['dh_params'])