Certificate rotation enhancements (#570)
This commit is contained in:
0
lemur/tests/test_deployment.py
Normal file
0
lemur/tests/test_deployment.py
Normal 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()
|
||||
|
||||
|
29
lemur/tests/test_messaging.py
Normal file
29
lemur/tests/test_messaging.py
Normal 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
|
Reference in New Issue
Block a user