From 41adfa3796c12cb72782a9843570038793660fb8 Mon Sep 17 00:00:00 2001 From: karthikmurakonda Date: Wed, 11 Oct 2023 07:18:28 +0530 Subject: [PATCH] fix token errors --- CDC_Backend/APIs/adminViews.py | 3 +-- CDC_Backend/APIs/companyViews.py | 2 +- CDC_Backend/APIs/tests/test_studentView.py | 8 +++++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CDC_Backend/APIs/adminViews.py b/CDC_Backend/APIs/adminViews.py index b951605..50a5ad8 100644 --- a/CDC_Backend/APIs/adminViews.py +++ b/CDC_Backend/APIs/adminViews.py @@ -425,7 +425,6 @@ def generateCSV(request, id, email, user_type): applications = PlacementApplication.objects.filter(placement=opening) filename = generateRandomString() if not os.path.isdir(STORAGE_DESTINATION_APPLICATION_CSV): - # create directory if not present already even if first directory is not present os.makedirs(STORAGE_DESTINATION_APPLICATION_CSV, exist_ok=True) destination_path = STORAGE_DESTINATION_APPLICATION_CSV + filename + ".csv" f = open(destination_path, 'w') @@ -459,7 +458,7 @@ def generateCSV(request, id, email, user_type): status=status.HTTP_200_OK) except: logger.warning("Create csv: " + str(sys.exc_info())) - return Response({'action': "Create csv", 'message': "Something Went Wrong"+str(sys.exc_info())}, + return Response({'action': "Create csv", 'message': "Something Went Wrong"}, status=status.HTTP_400_BAD_REQUEST) diff --git a/CDC_Backend/APIs/companyViews.py b/CDC_Backend/APIs/companyViews.py index 4b62728..cd73ce6 100644 --- a/CDC_Backend/APIs/companyViews.py +++ b/CDC_Backend/APIs/companyViews.py @@ -298,7 +298,7 @@ def verifyEmail(request): status=status.HTTP_400_BAD_REQUEST) except: logger.warning("Verify Email: " + str(sys.exc_info())) - return Response({'action': "Verify Email", 'message': "Something went wrong\n"+str(sys.exc_info())}, + return Response({'action': "Verify Email", 'message': "Something went wrong"}, status=status.HTTP_400_BAD_REQUEST) diff --git a/CDC_Backend/APIs/tests/test_studentView.py b/CDC_Backend/APIs/tests/test_studentView.py index e737387..21ce5ad 100644 --- a/CDC_Backend/APIs/tests/test_studentView.py +++ b/CDC_Backend/APIs/tests/test_studentView.py @@ -303,7 +303,7 @@ class StudentViewsTestCase(APITestCase): def test_add_application_placement_deadlinePassed(self): self.placement.deadline_datetime = timezone.now().replace( - hour=0, minute=0, second=0, microsecond=0) + hour=0, minute=0, second=0, microsecond=0) - datetime.timedelta(minutes=5) self.placement.save() # deleted existing application self.placement_application.delete() @@ -561,8 +561,10 @@ class StudentViewsTestCase(APITestCase): student=self.student).count(), 1) def test_add_application_internship_deadlinePassed(self): - self.internship.deadline_datetime = timezone.now().replace( - hour=0, minute=0, second=0, microsecond=0) + # now minus 5 minutes + self.internship.deadline_datetime = timezone.now().replace + (hour=0, minute=0, second=0, microsecond=0) - datetime.timedelta(minutes=5) + self.internship.save() # deleted existing application self.internship_application.delete()