Skip to content

Commit

Permalink
[ODS-6039] Descriptors in key not compared using case-insensitive com…
Browse files Browse the repository at this point in the history
…parison in PUT requests (#839)

* Perform case-insensitive comparisons on descriptor URIs when checking for attempts at key changes on PUT requests.

* Updated approval tests for case-insensitive comparisons on descriptors.

* Added Postman (regression) test coverage for PUT requests failing due to descriptor casing mismatch in the key.

* Fixed spelling error on "Authenticate", and reorganized all three sets of "Limit/Offset/Total Count" tests under a single folder, further delineated by a second level of folders using the name of the test subject resource.
  • Loading branch information
gmcelhanon authored Oct 6, 2023
1 parent 237580c commit cf94afa
Show file tree
Hide file tree
Showing 9 changed files with 1,964 additions and 1,812 deletions.
3,426 changes: 1,788 additions & 1,638 deletions Postman Test Suite/Ed-Fi ODS-API Integration Test Suite.postman_collection.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -3708,7 +3708,7 @@ public static bool SynchronizeTo(this IStudentArtProgramAssociation source, IStu
|| (target.EducationOrganizationId != source.EducationOrganizationId)
|| (target.ProgramEducationOrganizationId != source.ProgramEducationOrganizationId)
|| (!keyStringComparer.Equals(target.ProgramName, source.ProgramName))
|| (target.ProgramTypeDescriptor != source.ProgramTypeDescriptor)
|| !string.Equals(target.ProgramTypeDescriptor, source.ProgramTypeDescriptor, StringComparison.OrdinalIgnoreCase)
|| (target.StudentUniqueId != source.StudentUniqueId))
{
// Disallow PK column updates on StudentArtProgramAssociation
Expand Down Expand Up @@ -5000,7 +5000,7 @@ public static bool SynchronizeTo(this IStudentGraduationPlanAssociation source,
// Detect primary key changes
if (
(target.EducationOrganizationId != source.EducationOrganizationId)
|| (target.GraduationPlanTypeDescriptor != source.GraduationPlanTypeDescriptor)
|| !string.Equals(target.GraduationPlanTypeDescriptor, source.GraduationPlanTypeDescriptor, StringComparison.OrdinalIgnoreCase)
|| (target.GraduationSchoolYear != source.GraduationSchoolYear)
|| (target.StudentUniqueId != source.StudentUniqueId))
{
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -3708,7 +3708,7 @@ public static bool SynchronizeTo(this IStudentArtProgramAssociation source, IStu
|| (target.EducationOrganizationId != source.EducationOrganizationId)
|| (target.ProgramEducationOrganizationId != source.ProgramEducationOrganizationId)
|| (!keyStringComparer.Equals(target.ProgramName, source.ProgramName))
|| (target.ProgramTypeDescriptor != source.ProgramTypeDescriptor)
|| !string.Equals(target.ProgramTypeDescriptor, source.ProgramTypeDescriptor, StringComparison.OrdinalIgnoreCase)
|| (target.StudentUniqueId != source.StudentUniqueId))
{
// Disallow PK column updates on StudentArtProgramAssociation
Expand Down Expand Up @@ -5762,7 +5762,7 @@ public static bool SynchronizeTo(this IStudentGraduationPlanAssociation source,
// Detect primary key changes
if (
(target.EducationOrganizationId != source.EducationOrganizationId)
|| (target.GraduationPlanTypeDescriptor != source.GraduationPlanTypeDescriptor)
|| !string.Equals(target.GraduationPlanTypeDescriptor, source.GraduationPlanTypeDescriptor, StringComparison.OrdinalIgnoreCase)
|| (target.GraduationSchoolYear != source.GraduationSchoolYear)
|| (target.StudentUniqueId != source.StudentUniqueId))
{
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ private IEnumerable<object> AnnotateLocalIdentifyingPropertyKeys(Entity entity)
{
Name = x.GetModelsInterfacePropertyName(),
IsString = x.PropertyType.IsString(),
IsDescriptorUsage = x.IsDescriptorUsage,
})
.OrderBy(x => x.Name)
.ToList();
Expand All @@ -235,6 +236,7 @@ private IEnumerable<object> AnnotateLocalIdentifyingPropertyKeys(Entity entity)
{
PrimaryKeyName = x.Name,
IsString = x.IsString,
IsDescriptorUsage = x.IsDescriptorUsage,
IsFirst = i == 0,
IsLast = i == contextualIdList.Count - 1,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ namespace {{NamespaceName}} //.{{AggregateName}}Aggregate
// Detect primary key changes
if (
{{#AnnotatedLocalPrimaryKeyList}}
{{^IsFirst}}||{{/IsFirst}} {{#IsString}}(!keyStringComparer.Equals(target.{{PrimaryKeyName}}, source.{{PrimaryKeyName}})){{/IsString}}{{^IsString}}(target.{{PrimaryKeyName}} != source.{{PrimaryKeyName}}){{/IsString}}{{#IsLast}}){{/IsLast}}
{{^IsFirst}}||{{/IsFirst}} {{#IsDescriptorUsage}}!string.Equals(target.{{PrimaryKeyName}}, source.{{PrimaryKeyName}}, StringComparison.OrdinalIgnoreCase){{/IsDescriptorUsage}}{{#IsString}}(!keyStringComparer.Equals(target.{{PrimaryKeyName}}, source.{{PrimaryKeyName}})){{/IsString}}{{^IsString}}{{^IsDescriptorUsage}}(target.{{PrimaryKeyName}} != source.{{PrimaryKeyName}}){{/IsDescriptorUsage}}{{/IsString}}{{#IsLast}}){{/IsLast}}
{{/AnnotatedLocalPrimaryKeyList}}
{
{{#AllowPrimaryKeyUpdates}}
Expand Down

0 comments on commit cf94afa

Please sign in to comment.