Skip to content

Commit

Permalink
#81 - This should fix it
Browse files Browse the repository at this point in the history
  • Loading branch information
JarneClauw committed Mar 12, 2024
1 parent 94ef726 commit ec270d0
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 28 deletions.
8 changes: 0 additions & 8 deletions backend/tests/models/course_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
11 changes: 1 addition & 10 deletions backend/tests/models/project_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
Expand All @@ -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()
11 changes: 1 addition & 10 deletions backend/tests/models/submission_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
Expand All @@ -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()
Expand Down

0 comments on commit ec270d0

Please sign in to comment.