mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
change type of error
This commit is contained in:
parent
c893b81314
commit
941efd08d1
@ -7,6 +7,7 @@ import django.core.exceptions as django_exceptions
|
|||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.contrib.auth import get_user_model
|
from django.contrib.auth import get_user_model
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
from django.db.utils import IntegrityError
|
||||||
|
|
||||||
from djmoney.money import Money
|
from djmoney.money import Money
|
||||||
from djmoney.contrib.exchange.models import Rate, convert_money
|
from djmoney.contrib.exchange.models import Rate, convert_money
|
||||||
@ -451,5 +452,13 @@ class TestSettings(TestCase):
|
|||||||
self.run_reload()
|
self.run_reload()
|
||||||
self.assertEqual(user_count(), 1)
|
self.assertEqual(user_count(), 1)
|
||||||
|
|
||||||
|
# double adding should not work
|
||||||
|
self.env.set('INVENTREE_ADMIN_USER', 'admin') # set username
|
||||||
|
self.env.set('INVENTREE_ADMIN_EMAIL', 'info@example.com') # set email
|
||||||
|
self.env.set('INVENTREE_ADMIN_PASSWORD', 'password123') # set password
|
||||||
|
with self.assertRaises(IntegrityError):
|
||||||
|
self.run_reload()
|
||||||
|
self.assertEqual(user_count(), 1)
|
||||||
|
|
||||||
# make sure to clean up
|
# make sure to clean up
|
||||||
settings.TESTING_ENV = False
|
settings.TESTING_ENV = False
|
||||||
|
Loading…
Reference in New Issue
Block a user