Skip to content

Commit ad4bdf5

Browse files
committed
OpenConceptLab/ocl_issues#2406 | making it case insensitive
1 parent 2d3874c commit ad4bdf5

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

core/concepts/custom_validators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def no_other_record_has_same_name(self, name, versioned_object_id, filters=None)
117117
concept__retired=False,
118118
concept__is_latest_version=True,
119119
locale=name.locale,
120-
name=name.name,
120+
name__iexact=name.name,
121121
**filters
122122
).exists()
123123

core/concepts/tests/tests.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1800,8 +1800,8 @@ def test_concepts_should_have_unique_fully_specified_name_per_locale(self):
18001800
}
18011801
)
18021802

1803-
def test_duplicate_fully_specified_name_per_source_should_fail_even_with_unrelated_null_typed_name(self):
1804-
"""Regression for #2406: duplicate FSNs must still be caught when another concept also has NULL-typed names."""
1803+
def test_duplicate_fully_specified_name_per_source_should_fail_case_insensitively_even_with_null_typed_name(self):
1804+
"""Regression for #2406: duplicate FSNs must be rejected case-insensitively even with NULL-typed names."""
18051805
source = OrganizationSourceFactory(custom_validation_schema=OPENMRS_VALIDATION_SCHEMA, version=HEAD)
18061806

18071807
concept1 = Concept.persist_new(
@@ -1830,7 +1830,7 @@ def test_duplicate_fully_specified_name_per_source_should_fail_even_with_unrelat
18301830
'datatype': 'None',
18311831
'names': [
18321832
ConceptNameFactory.build(
1833-
name='Cerebral malaria', locale='en', locale_preferred=True, type='Fully Specified'
1833+
name='cerebral malaria', locale='en', locale_preferred=True, type='Fully Specified'
18341834
),
18351835
]
18361836
}
@@ -1841,7 +1841,7 @@ def test_duplicate_fully_specified_name_per_source_should_fail_even_with_unrelat
18411841
concept2.errors,
18421842
{
18431843
'names': [OPENMRS_FULLY_SPECIFIED_NAME_UNIQUE_PER_SOURCE_LOCALE +
1844-
': Cerebral malaria (locale: en, preferred: yes)']
1844+
': cerebral malaria (locale: en, preferred: yes)']
18451845
}
18461846
)
18471847

0 commit comments

Comments
 (0)