diff --git a/.env-sample b/.env-sample index 8a1045f6..84dce51b 100644 --- a/.env-sample +++ b/.env-sample @@ -64,7 +64,7 @@ ALTERNATIVE_NAME = 'RoboSats Mainnet' # Telegram bot token TELEGRAM_TOKEN = '' -TELEGRAM_BOT_NAME = '' +TELEGRAM_BOT_NAME = 'RoboCoordinatorNotificationBot' # Notify new messages in-chat app (fiat exchange step) if at least X minutes has passed since the last chat message. CHAT_NOTIFICATION_TIMEGAP = 5 diff --git a/api/notifications.py b/api/notifications.py index 2b07310c..8d1e0e65 100644 --- a/api/notifications.py +++ b/api/notifications.py @@ -21,7 +21,7 @@ class Telegram: context["tg_enabled"] = False if user.robot.telegram_token is None: - user.robot.telegram_token = token_urlsafe(15) + user.robot.telegram_token = token_urlsafe()[:15] user.robot.save(update_fields=["telegram_token"]) context["tg_token"] = user.robot.telegram_token diff --git a/api/tests/test_utils.py b/api/tests/test_utils.py index 6a018427..b1d9d913 100644 --- a/api/tests/test_utils.py +++ b/api/tests/test_utils.py @@ -176,10 +176,10 @@ class TestUtils(TestCase): client_enc_priv_key = r"-----BEGIN PGP PRIVATE KEY BLOCK-----\\xYYEZTWJ1xYJKwYBBAHaRw8BAQdAsfdKb90BurKniu+pBPBDHCkzg08S51W0\mUR0SKqLmdj+CQMICrS3TNCA/LHgxckC+iTUMxkqQJ9GpXWCDacx1rBQCztu\PDgUHNvWdcvW1wWVxU/aJaQLqBTtRVYkJTz332jrKvsSl/LnrfwmUfKgN4nG\Oc1MUm9ib1NhdHMgSUQgNTUyZGQxYTY2MWE3YWNhNGE0MWY4ODkxMGZmMzRh\YzNiMWFjODBiYjc3OTRlZDlmZDU1ZDhiNzZiOTdhYWQ5N8KMBBAWCgA+BYJl\NYnXBAsJBwgJkDc3tq7iCL/OAxUICgQWAAIBAhkBApsDAh4BFiEE7mIEuePQ\n8Tqye0QNze2ruIIv84AAORXAQD+0G30U+qvEsc48W3JTKmmmvT+3q+uXdGs\vMIuqoTWdQD/R+aGKvYXzwpyzGYInAAOj8WCXBcYWSOtXiw/oWNgEQHHiwRl\NYnXEgorBgEEAZdVAQUBAQdALJQh7exBNphr8gU0oY2ZfP/6Gse6Ryi3hM6+\LZsP2nwDAQgH/gkDCPPoYWyzm4mT4N/TDBF11GVq0xSEEcubFqjArFKyibRy\TDnB8+o8BlkRuGClcfRyKkR5/Rp1v5B0n1BuMsc8nY4Yg4BJv4KhsPfXRp4m\31zCeAQYFggAKgWCZTWJ1wmQNze2ruIIv84CmwwWIQTuYgS549CfxOrJ7RA3\N7au4gi/zgAAmhQA+wRtxO05FKFirSXuTj808F/mzF8u4Wz0kMNMzPUXvCj9\AQCHkxvHdvNHUyut4f7HkACnjI9M3+wGF69ArHL0u39/Aw==\=1hCT\-----END PGP PRIVATE KEY BLOCK-----" # Example valid formatted GPG keys - with open("api/tests/test_pub_key", "r") as file: + with open("tests/robots/1/pub_key", "r") as file: # Read the contents of the file pub_key = file.read() - with open("api/tests/test_enc_priv_key", "r") as file: + with open("tests/robots/1/enc_priv_key", "r") as file: # Read the contents of the file enc_priv_key = file.read() @@ -203,10 +203,10 @@ class TestUtils(TestCase): def test_verify_signed_message(self): # Call the verify_signed_message function with a mock public key and a mock signed message - with open("api/tests/test_pub_key", "r") as file: + with open("tests/robots/1/pub_key", "r") as file: # Read the contents of the file pub_key = file.read() - with open("api/tests/test_signed_message", "r") as file: + with open("tests/robots/1/signed_message", "r") as file: # Read the contents of the file signed_message = file.read() diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/robots/1/b91_token b/tests/robots/1/b91_token new file mode 100644 index 00000000..ce6e527b --- /dev/null +++ b/tests/robots/1/b91_token @@ -0,0 +1 @@ +qz*fp3CzNfK0Y2MWx;