diff --git a/backend/tests/models/course_test.py b/backend/tests/models/course_test.py index b0f2b497..89295896 100644 --- a/backend/tests/models/course_test.py +++ b/backend/tests/models/course_test.py @@ -33,14 +33,6 @@ def test_update_course(self, session: Session): def test_delete_course(self, session: Session): """Test if a course can be deleted""" - def test_primary_key(self, session: Session): - """Test the primary key""" - courses = session.query(Course).all() - with raises(IntegrityError): - courses[0].course_id = courses[1].course_id - session.commit() - session.rollback() - def test_foreign_key_teacher(self, session: Session): """Test the foreign key teacher""" course = session.query(Course).filter_by(name="AD3").first() diff --git a/backend/tests/models/project_test.py b/backend/tests/models/project_test.py index 32e71d5d..84e4ef7a 100644 --- a/backend/tests/models/project_test.py +++ b/backend/tests/models/project_test.py @@ -63,7 +63,7 @@ def test_foreign_key_course_id(self, session: Session): session.rollback() @mark.parametrize("property_name", - ["project_id","title","descriptions","course_id","visible_for_students","archieved"] + ["title","descriptions","course_id","visible_for_students","archieved"] ) def test_property_not_nullable(self, session: Session, property_name: str): """Test if the property is not nullable""" @@ -72,12 +72,3 @@ def test_property_not_nullable(self, session: Session, property_name: str): setattr(project, property_name, None) session.commit() session.rollback() - - @mark.parametrize("property_name", ["project_id"]) - def test_property_unique(self, session: Session, property_name: str): - """Test if the property is unique""" - projects = session.query(Project).all() - with raises(IntegrityError): - setattr(projects[0], property_name, getattr(projects[1], property_name)) - session.commit() - session.rollback() diff --git a/backend/tests/models/submission_test.py b/backend/tests/models/submission_test.py index 68548570..5b2f7c86 100644 --- a/backend/tests/models/submission_test.py +++ b/backend/tests/models/submission_test.py @@ -73,7 +73,7 @@ def test_foreign_key_project_id(self, session: Session): session.rollback() @mark.parametrize("property_name", - ["submission_id","uid","project_id","submission_time","submission_path","submission_status"] + ["uid","project_id","submission_time","submission_path","submission_status"] ) def test_property_not_nullable(self, session: Session, property_name: str): """Test if the property is not nullable""" @@ -83,15 +83,6 @@ def test_property_not_nullable(self, session: Session, property_name: str): session.commit() session.rollback() - @mark.parametrize("property_name", ["submission_id"]) - def test_property_unique(self, session: Session, property_name: str): - """Test if the property is unique""" - submissions = session.query(Submission).all() - with raises(IntegrityError): - setattr(submissions[0], property_name, getattr(submissions[1], property_name)) - session.commit() - session.rollback() - def test_grading_constraint(self, session: Session): """Test if the grading is between 0 and 20""" submission = session.query(Submission).first()