Fakultas Ilmu Komputer UI
Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
PMPL
Class Project
Kape
Commits
b7d6d0fe
Commit
b7d6d0fe
authored
Nov 15, 2019
by
Yusuf Sholeh
Browse files
Fix failed tests
parent
2475179b
Pipeline
#25169
passed with stages
in 5 minutes and 40 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
core/tests/test_vacancies.py
View file @
b7d6d0fe
...
...
@@ -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"
]
=
231231
221312
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
,
...
...
core/views/vacancies.py
View file @
b7d6d0fe
...
...
@@ -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
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment