WhyNotHugo / django-mercadopago

⚠️ Deprecated. Use https://github.com/jazzband/django-payments/ instead.
ISC License
33 stars 12 forks source link

AccountFactory updated #18

Closed pwqw closed 5 years ago

pwqw commented 5 years ago

Sometimes, some test fails throwing:

django.db.utils.IntegrityError: duplicate key value violates unique constraint "mp_account_slug_f896377f_uniq"
DETAIL:  Key (slug)=(test) already exists.
WhyNotHugo commented 5 years ago

Which test fails? I don't see any test creating multiple Accounts.

pwqw commented 5 years ago

I'm sorry, I expressed myself badly. The tests that failed me were private.

But, by definition, the slug is unique = True, so I assume that the AccountFactory must have at least one of the following 2 options: django_get_or_create = ('name', 'slug', ) or this one: slug = Sequence(lambda n: 'test_%d' % n)

WhyNotHugo commented 5 years ago

Sounds like you just need to fix your tests, and create different accounts:

account = AccountFactory()
another_account = AccountFactory(slug='account2')