Skip to content

Commit

Permalink
fix: faculty tests
Browse files Browse the repository at this point in the history
  • Loading branch information
EwoutV committed Apr 4, 2024
1 parent 0a2f284 commit e6d5628
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion backend/api/tests/test_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
def create_faculty(name):
"""
Create a Faculty with the given arguments."""
return Faculty.objects.create(name=name)
return Faculty.objects.create(id=name,name=name)


def create_admin(id, first_name, last_name, email, faculty=None):
Expand Down
2 changes: 1 addition & 1 deletion backend/api/tests/test_assistant.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def create_course(name, academic_startyear, description=None, parent_course=None

def create_faculty(name):
"""Create a Faculty with the given arguments."""
return Faculty.objects.create(name=name)
return Faculty.objects.create(id=name,name=name)


def create_assistant(id, first_name, last_name, email, faculty=None, courses=None):
Expand Down
2 changes: 1 addition & 1 deletion backend/api/tests/test_student.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def create_course(name, academic_startyear, description=None, parent_course=None

def create_faculty(name):
"""Create a Faculty with the given arguments."""
return Faculty.objects.create(name=name)
return Faculty.objects.create(id=name,name=name)


def create_student(id, first_name, last_name, email, faculty=None, courses=None):
Expand Down
2 changes: 1 addition & 1 deletion backend/api/tests/test_teacher.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def create_course(name, academic_startyear, description=None, parent_course=None

def create_faculty(name):
"""Create a Faculty with the given arguments."""
return Faculty.objects.create(name=name)
return Faculty.objects.create(id=name,name=name)


def create_teacher(id, first_name, last_name, email, faculty=None, courses=None):
Expand Down
3 changes: 2 additions & 1 deletion backend/api/views/course_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class CourseViewSet(viewsets.ModelViewSet):
"""Actions for general course logic"""
queryset = Course.objects.all()
serializer_class = CourseSerializer
pagination_class = BasicPagination
permission_classes = [IsAdminUser | CoursePermission]

def create(self, request: Request, *_):
Expand All @@ -50,6 +49,8 @@ def create(self, request: Request, *_):

@action(detail=False)
def search(self, request: Request) -> Response:
self.pagination_class = BasicPagination

# Extract filter params
search = request.query_params.get("search", "")
years = request.query_params.getlist("years[]")
Expand Down

0 comments on commit e6d5628

Please sign in to comment.