12 lines
569 B
Python
12 lines
569 B
Python
import os
|
|
import testinfra.utils.commands as commands
|
|
|
|
def test_login_notification_is_sent():
|
|
# Vérifier que la notification a été envoyée
|
|
notification_file = os.path.join('/tmp', 'login_notification.json')
|
|
assert commands.check_output('test -f {}'.format(notification_file)) == 0
|
|
|
|
# Vérifier le contenu du fichier de notification
|
|
notification_data = json.loads(commands.check_output('cat {}'.format(notification_file)))
|
|
assert notification_data['title'] == 'Connexion SSH'
|
|
assert notification_data['message'].startswith('Utilisateur')
|