Certificate rotation enhancements (#570)

This commit is contained in:
kevgliss
2016-12-07 16:24:59 -08:00
committed by GitHub
parent 9adc5ad59e
commit fc205713c8
19 changed files with 607 additions and 598 deletions

View File

View File

@ -8,7 +8,7 @@ from .vectors import VALID_ADMIN_HEADER_TOKEN, VALID_USER_HEADER_TOKEN
def test_rotate_certificate(client, source_plugin):
from lemur.endpoints.service import rotate_certificate
from lemur.deployment.service import rotate_certificate
new_certificate = CertificateFactory()
endpoint = EndpointFactory()

View File

@ -0,0 +1,29 @@
import pytest
from freezegun import freeze_time
from datetime import timedelta
def test_needs_notification(app, certificate, notification):
from lemur.notifications.messaging import needs_notification
assert not needs_notification(certificate)
with pytest.raises(Exception):
notification.options = [{'name': 'interval', 'value': 10}, {'name': 'unit', 'value': 'min'}]
certificate.notifications.append(notification)
needs_notification(certificate)
certificate.notifications[0].options = [{'name': 'interval', 'value': 10}, {'name': 'unit', 'value': 'days'}]
assert not needs_notification(certificate)
delta = certificate.not_after - timedelta(days=10)
with freeze_time(delta.datetime):
assert needs_notification(certificate)
def test_send_expiration_notification():
assert False
def test_send_rotation_notification():
assert False