From f09a1b67f504e0cfbf4ace7cb6d5313c5f64c423 Mon Sep 17 00:00:00 2001 From: catborise Date: Sun, 8 Nov 2026 20:54:13 +0300 Subject: [PATCH] test(accounts): validate_ssh_key is tested in one place test_ssh_keys repeated test_utils' cases of a key with and without a comment and of an invalid key; test_utils keeps them. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea --- accounts/tests/test_ssh_keys.py | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/accounts/tests/test_ssh_keys.py b/accounts/tests/test_ssh_keys.py index 02cd9495..0c657104 100644 --- a/accounts/tests/test_ssh_keys.py +++ b/accounts/tests/test_ssh_keys.py @@ -1,10 +1,9 @@ -"""A user's SSH keys: they go with the user, and a key is valid with or without a comment.""" +"""A user's SSH keys go with the user (validate_ssh_key: test_utils).""" from django.contrib.auth import get_user_model from django.test import TestCase from accounts.models import UserSSHKey -from accounts.utils import validate_ssh_key class SshKeyTestCase(TestCase): @@ -21,15 +20,3 @@ class SshKeyTestCase(TestCase): user.delete() self.assertFalse(UserSSHKey.objects.filter(id=key.id).exists()) - def test_validate_ssh_key_supports_keys_with_and_without_comment(self): - rsa_base = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQC6OOdbfv27QVnSC6sKxGaHb6YFc+3gxCkyVR3cTSXE/n5BEGf8aOgBpepULWa1RZfxYHY14PlKULDygdXSdrrR2kNSwoKz/Oo4d+3EE92L7ocl1+djZbptzgWgtw1OseLwbFik+iKlIdqPsH+IUQvX7yV545ZQtAP8Qj1R+uCqkw==" - # Key with comment - key_with_comment = f"{rsa_base} test@test" - self.assertTrue(validate_ssh_key(key_with_comment)) - - # Key without comment - key_without_comment = rsa_base - self.assertTrue(validate_ssh_key(key_without_comment)) - - # Invalid key - self.assertFalse(validate_ssh_key("not a valid key string"))