Closed lunika closed 3 months ago
Problematic behavior
In the CourseModel, the resource_link attribute has a unique constraint. Despite this constraint, we are able to create multiple CourseRun with the same resource_link.
CourseModel
resource_link
CourseRun
I wrote this test to reproduce:
def test_course_run_resource_link_unicity(self): resource_link = "https://moodle.test/session1" course_run1 = factories.CourseRunFactory(resource_link=resource_link) self.assertEqual(course_run1.resource_link, resource_link) course_run2 = factories.CourseRunFactory(resource_link=resource_link) self.assertEqual(course_run2.resource_link, resource_link)
The seconde CourseRun creation should fail.
Expected behavior/code
When an existing resource_link exists in the CourseRun table, an exception should be raised.
It's not a bug. It's a feature :tm:
The factory is creating only one CourseRun.
Bug Report
Problematic behavior
In the
CourseModel
, theresource_link
attribute has a unique constraint. Despite this constraint, we are able to create multipleCourseRun
with the sameresource_link
.I wrote this test to reproduce:
The seconde
CourseRun
creation should fail.Expected behavior/code
When an existing
resource_link
exists in theCourseRun
table, an exception should be raised.