Fakultas Ilmu Komputer UI

Commit 84c33fbd authored by Yusuf Sholeh's avatar Yusuf Sholeh
Browse files

Merge branch '1606862791-150' into 'master'

Fix failed tests

See merge request !165
parents 058edc5a b7d6d0fe
Pipeline #25170 passed with stages
in 11 minutes and 24 seconds
......@@ -607,8 +607,8 @@ class ValidationPositionNameinCreateLowonganKP(APITestCase):
self.payload = {
"name": "dummy",
"company" : self.company.id,
"open_time" : datetime.fromtimestamp(0),
"close_time" : datetime.today(),
"open_time" : datetime.today(),
"close_time" : datetime.today() + timedelta(days=10),
"description" : "dummy",
"working_period": "Summer 2019",
"max_accepted_applicants": 10,
......@@ -704,7 +704,7 @@ class ValidationPositionNameinCreateLowonganKP(APITestCase):
self.assertEqual(response_status_code, 400)
def test_amount_contains_number_only(self):
self.payload["amount"] = 231231221312
self.payload["amount"] = 231231
response = self.client.post(
self.url,
......@@ -716,7 +716,7 @@ class ValidationPositionNameinCreateLowonganKP(APITestCase):
self.assertEqual(response_status_code, 200)
def test_max_accepted_applicants_contains_only_number(self):
self.payload[""] = "11"
self.payload["max_accepted_applicants"] = "11"
response = self.client.post(
self.url,
......@@ -728,7 +728,7 @@ class ValidationPositionNameinCreateLowonganKP(APITestCase):
self.assertEqual(response_status_code, 200)
def test_max_accepted_applicants_contains_only_alphabet(self):
self.payload[""] = "abcd"
self.payload["max_accepted_applicants"] = "abcd"
response = self.client.post(
self.url,
......@@ -740,7 +740,7 @@ class ValidationPositionNameinCreateLowonganKP(APITestCase):
self.assertEqual(response_status_code, 400)
def test_max_accepted_applicants_contains_number_and_alphabet(self):
self.payload[""] = "a1r1"
self.payload["max_accepted_applicants"] = "a1r1"
response = self.client.post(
self.url,
......
......@@ -181,6 +181,9 @@ class VacancyViewSet(MultiSerializerViewSetMixin, viewsets.ModelViewSet):
except ValidationError as e:
print("[LOG] error: " + str(e))
return Response({"error": str(e.detail[0])}, status=status.HTTP_400_BAD_REQUEST)
except ValueError as e:
print("[LOG] error: " + str(e))
return Response({"error": str(e)}, status=status.HTTP_400_BAD_REQUEST)
return Response(status=status.HTTP_200_OK)
def partial_update(self, request, pk):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment