Further attempts to fix CI issues

This commit is contained in:
Oliver 2022-04-22 14:33:46 +10:00
parent 4994920119
commit 99718865c0
3 changed files with 6 additions and 7 deletions

View File

@ -553,8 +553,7 @@ db_config['TEST'] = {
# Set collation option for mysql test database
if 'mysql' in db_engine:
# Ref: https://docs.djangoproject.com/en/4.0/ref/databases/#collation-settings
db_config['TEST']['COLLATION'] = 'utf8_bin'
db_config['TEST']['COLLATION'] = 'utf8_general_ci'
DATABASES = {
'default': db_config

View File

@ -779,7 +779,7 @@ class Part(MPTTModel):
# Raise an error if an IPN is set, and it is a duplicate
if self.IPN and not allow_duplicate_ipn:
parts = Part.objects.filter(IPN=self.IPN)
parts = Part.objects.filter(IPN__iexact=self.IPN)
parts = parts.exclude(pk=self.pk)
if parts.exists():

View File

@ -352,10 +352,10 @@ class PartSettingsTest(TestCase):
# Any duplicate IPN should raise an error
Part.objects.create(name='xyz', revision='1', description='A part', IPN='UNIQUE')
# Case sensitive, so other variations don't error out:
Part.objects.create(name='xyz', revision='2', description='A part', IPN='UNIQUe')
Part.objects.create(name='xyz', revision='3', description='A part', IPN='UNIQuE')
Part.objects.create(name='xyz', revision='4', description='A part', IPN='UNIqUE')
# Case insensitive, so variations on spelling should throw an error
for ipn in ['UNiquE', 'uniQuE', 'unique']:
with self.assertRaises(ValidationError):
Part.objects.create(name='xyz', revision='2', description='A part', IPN=ipn)
with self.assertRaises(ValidationError):
Part.objects.create(name='zyx', description='A part', IPN='UNIQUE')