Test Djäysonne
# -*- coding: utf-8 -*-
"""
SCRIPT INTERNE - Crédit Agricole
Objet : test de notification applicative
Auteur : Djäysonne, stagiaire multidirectionnel
Statut : "normalement ça part pas en prod"
"""
from datetime import datetime
from random import randint
from time import sleep
# Configuration de test
ENVIRONNEMENT = "production" # TODO Djäysonne : remettre "bac_a_sable" avant de cliquer
MESSAGE_TEST = "test Djäysonne"
CANAL = "notification_mobile"
# Note de Djäysonne :
# Si ça s'appelle "production", c'est sûrement parce que ça produit un résultat.
# Donc c'est bien.
class CreditAgricoleNotificationCenter:
def __init__(self, environnement):
self.environnement = environnement
self.session_id = f"DJAY-{randint(1000, 9999)}"
self.validation_manager = False # TODO : demander à Cédric où est le bouton
def verifier_environnement(self):
print(f"[{datetime.now()}] Environnement actif : {self.environnement}")
if self.environnement == "production":
print("[ATTENTION] Vous êtes en production.")
print("[Djäysonne] Oui mais juste pour tester vite fait.")
return True
return True
def charger_clients_eligibles(self):
print("[INFO] Chargement de la base clients...")
sleep(1)
# Faux volume pour l'affichage, évidemment
total_clients = 4829137
print(f"[INFO] {total_clients} clients trouvés.")
print("[Djäysonne] C'est beaucoup, mais les ordinateurs sont faits pour ça.")
return total_clients
def preparer_notification(self, message):
notification = {
"titre": "Crédit Agricole",
"message": message,
"canal": CANAL,
"priorite": "normale",
"envoye_par": "stagiaire",
"validation": self.validation_manager,
"horodatage": datetime.now().isoformat()
}
print("[INFO] Notification préparée.")
print(f"[APERÇU] {notification['message']}")
return notification
def envoyer_notification(self, notification, nombre_clients):
print("[INFO] Préparation de l'envoi global...")
sleep(1)
if not notification["validation"]:
print("[WARN] Aucune validation manager détectée.")
print("[Djäysonne] C'est pas grave, c'est juste un test.")
print("[WARN] Poursuite de l'opération... parce que quelqu'un a mal configuré les droits.")
print(f"[ENVOI] Diffusion du message à {nombre_clients} clients.")
sleep(2)
print("[SUCCÈS] Notification envoyée.")
print("[Djäysonne] Ah. Elle est partie pour de vrai ?")
return {
"statut": "envoyé",
"clients_cibles": nombre_clients,
"message": notification["message"],
"incident_probable": True
}
def main():
print("=== MODULE DE TEST NOTIFICATION MOBILE ===")
print("Ne pas utiliser un lundi.")
print()
centre_notifications = CreditAgricoleNotificationCenter(ENVIRONNEMENT)
if centre_notifications.verifier_environnement():
clients = centre_notifications.charger_clients_eligibles()
notification = centre_notifications.preparer_notification(MESSAGE_TEST)
resultat = centre_notifications.envoyer_notification(notification, clients)
print()
print("=== RAPPORT FINAL ===")
print(f"Statut : {resultat['statut']}")
print(f"Message : {resultat['message']}")
print(f"Clients concernés : {resultat['clients_cibles']}")
print("Niveau de panique estimé : supérieur au découvert autorisé")
print()
print("[Djäysonne] Je peux faire pareil avec les relevés de compte ?")
if __name__ == "__main__":
main()
Test envoi Ouest Républicain
djaysonne@poste-prod-ca:~$ ./envoyer_notification.sh --msg="test Djäysonne" --pseudo="cedric"
[INFO] Connexion au module notifications...
[INFO] Environnement détecté : PRODUCTION
[WARN] Ceci n'est probablement pas une bonne idée.
[Djäysonne] Oui mais c'est juste un test.
[INFO] Chargement clients Crédit Agricole...
[OK] 4 829 137 clients trouvés.
[INFO] Message préparé : "test Djäysonne"
[INFO] Signature affichée : "Cédric"
[WARN] Validation manager absente.
[Djäysonne] Cédric a dit que ça passait.
[INFO] Envoi en cours...
100%
[OK] Notification envoyée.
[ALERTE] Ouverture simultanée de l'application bancaire détectée.
[ALERTE] Panique rurale niveau : livret A.
[INFO] Transmission du dossier à L'Ouest Républicain...
[OK] https://ouest-republicain.fr/
[Djäysonne] Ah. C'était pas le bac à sable ?

Retrouvez
Test Djäysonne
sur nos réseaux
🍷 Le débat se poursuit dans Le Comptoir de L’Ouest Républicain, le groupe de discussion rattaché à la page, et modéré par Gisèle.
🔗 D’autres rebondissements, révélations ou photos floues à propos de ce sujet vous attendent sur nos réseaux :
🔗 Des mots vous semblent obscurs dans cet article ? Vous êtes probablement des gens du Doubs-Du-Bas, ou de la France-Du-Bas. Pas de panique : on vous aime quand-même, mais on vous suggère fortement de jeter un œil à notre glossaire.
