methode clean dans MergeForm

fixed formatting

Update rootplace/forms.py

Co-authored-by: thomas girod <56346771+imperosol@users.noreply.github.com>

Check that a user cannot be merged into itself

ajout des traductions

changed test language to french

Check that a user cannot be merged into itself
This commit is contained in:
Kenneth SOARES
2025-03-28 12:27:21 +01:00
parent ac1e40038e
commit df2d0d4d4c
4 changed files with 41 additions and 15 deletions

View File

@ -22,6 +22,7 @@ from django.utils.timezone import localtime, now
from club.models import Club
from core.models import Group, User
from counter.models import Counter, Customer, Product, Refilling, Selling
from rootplace.forms import MergeForm
from subscription.models import Subscription
@ -79,6 +80,15 @@ class TestMergeUser(TestCase):
sas_admin.id,
}
def test_identical_accounts(self):
form = MergeForm(data={"user1": self.to_keep.id, "user2": self.to_keep.id})
assert not form.is_valid()
assert "__all__" in form.errors
assert (
"Vous ne pouvez pas fusionner deux utilisateurs identiques."
in form.errors["__all__"]
)
def test_both_subscribers_and_with_account(self):
Customer(user=self.to_keep, account_id="11000l", amount=0).save()
Customer(user=self.to_delete, account_id="12000m", amount=0).save()