def test_reenroll_unreachable_server_address(self): """Test reenroll unreachable server address. """ self._ca_server_address = "test:80" ca_service = CAService("http://" + self._ca_server_address) with self.assertRaises(Exception): ca_service.reenroll(self._enrollment)
def test_reenroll_after_revoke_success(self): """Test revoke success. """ ca_service = CAService("http://" + self._ca_server_address) enrollment = ca_service.enroll(self._enrollment_id, self._enrollment_secret) # use a random username for registering for avoiding already register # issues when test suite ran several times username = get_random_username() secret = enrollment.register(username) # enroll new user enrollment = ca_service.enroll(username, secret) # now revoke enrollment.revoke(username) # reenroll with self.assertRaises(Exception): ca_service.reenroll(enrollment)
def test_reenroll_success(self): """Test revoke success. """ ca_service = CAService("http://" + self._ca_server_address) enrollment = ca_service.enroll(self._enrollment_id, self._enrollment_secret) # use a random username for registering for avoiding already register # issues when test suite ran several times username = get_random_username() secret = enrollment.register(username) # enroll new user enrollment = ca_service.enroll(username, secret) # reenroll reenrollment = ca_service.reenroll(enrollment) self.assertTrue(reenrollment.cert .startswith(b"-----BEGIN CERTIFICATE-----"))
def test_reenroll_wrong_attr_req(self): """Test reenroll wrong attr_req """ ca_service = CAService("http://" + self._ca_server_address) with self.assertRaises(AttributeError): ca_service.reenroll(self._enrollment, [''])
def test_reenroll_no_user(self): """Test reenroll no user """ ca_service = CAService("http://" + self._ca_server_address) with self.assertRaises(ValueError): ca_service.reenroll('foo')