Fakultas Ilmu Komputer UI
Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
PMPL
Class Project
Kape
Commits
84c33fbd
Commit
84c33fbd
authored
Nov 15, 2019
by
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
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
core/tests/test_vacancies.py
View file @
84c33fbd
...
@@ -607,8 +607,8 @@ class ValidationPositionNameinCreateLowonganKP(APITestCase):
...
@@ -607,8 +607,8 @@ class ValidationPositionNameinCreateLowonganKP(APITestCase):
self
.
payload
=
{
self
.
payload
=
{
"name"
:
"dummy"
,
"name"
:
"dummy"
,
"company"
:
self
.
company
.
id
,
"company"
:
self
.
company
.
id
,
"open_time"
:
datetime
.
fromtimestamp
(
0
),
"open_time"
:
datetime
.
today
(
),
"close_time"
:
datetime
.
today
(),
"close_time"
:
datetime
.
today
()
+
timedelta
(
days
=
10
)
,
"description"
:
"dummy"
,
"description"
:
"dummy"
,
"working_period"
:
"Summer 2019"
,
"working_period"
:
"Summer 2019"
,
"max_accepted_applicants"
:
10
,
"max_accepted_applicants"
:
10
,
...
@@ -704,7 +704,7 @@ class ValidationPositionNameinCreateLowonganKP(APITestCase):
...
@@ -704,7 +704,7 @@ class ValidationPositionNameinCreateLowonganKP(APITestCase):
self
.
assertEqual
(
response_status_code
,
400
)
self
.
assertEqual
(
response_status_code
,
400
)
def
test_amount_contains_number_only
(
self
):
def
test_amount_contains_number_only
(
self
):
self
.
payload
[
"amount"
]
=
231231
221312
self
.
payload
[
"amount"
]
=
231231
response
=
self
.
client
.
post
(
response
=
self
.
client
.
post
(
self
.
url
,
self
.
url
,
...
@@ -716,7 +716,7 @@ class ValidationPositionNameinCreateLowonganKP(APITestCase):
...
@@ -716,7 +716,7 @@ class ValidationPositionNameinCreateLowonganKP(APITestCase):
self
.
assertEqual
(
response_status_code
,
200
)
self
.
assertEqual
(
response_status_code
,
200
)
def
test_max_accepted_applicants_contains_only_number
(
self
):
def
test_max_accepted_applicants_contains_only_number
(
self
):
self
.
payload
[
""
]
=
"11"
self
.
payload
[
"
max_accepted_applicants
"
]
=
"11"
response
=
self
.
client
.
post
(
response
=
self
.
client
.
post
(
self
.
url
,
self
.
url
,
...
@@ -728,7 +728,7 @@ class ValidationPositionNameinCreateLowonganKP(APITestCase):
...
@@ -728,7 +728,7 @@ class ValidationPositionNameinCreateLowonganKP(APITestCase):
self
.
assertEqual
(
response_status_code
,
200
)
self
.
assertEqual
(
response_status_code
,
200
)
def
test_max_accepted_applicants_contains_only_alphabet
(
self
):
def
test_max_accepted_applicants_contains_only_alphabet
(
self
):
self
.
payload
[
""
]
=
"abcd"
self
.
payload
[
"
max_accepted_applicants
"
]
=
"abcd"
response
=
self
.
client
.
post
(
response
=
self
.
client
.
post
(
self
.
url
,
self
.
url
,
...
@@ -740,7 +740,7 @@ class ValidationPositionNameinCreateLowonganKP(APITestCase):
...
@@ -740,7 +740,7 @@ class ValidationPositionNameinCreateLowonganKP(APITestCase):
self
.
assertEqual
(
response_status_code
,
400
)
self
.
assertEqual
(
response_status_code
,
400
)
def
test_max_accepted_applicants_contains_number_and_alphabet
(
self
):
def
test_max_accepted_applicants_contains_number_and_alphabet
(
self
):
self
.
payload
[
""
]
=
"a1r1"
self
.
payload
[
"
max_accepted_applicants
"
]
=
"a1r1"
response
=
self
.
client
.
post
(
response
=
self
.
client
.
post
(
self
.
url
,
self
.
url
,
...
...
core/views/vacancies.py
View file @
84c33fbd
...
@@ -181,6 +181,9 @@ class VacancyViewSet(MultiSerializerViewSetMixin, viewsets.ModelViewSet):
...
@@ -181,6 +181,9 @@ class VacancyViewSet(MultiSerializerViewSetMixin, viewsets.ModelViewSet):
except
ValidationError
as
e
:
except
ValidationError
as
e
:
print
(
"[LOG] error: "
+
str
(
e
))
print
(
"[LOG] error: "
+
str
(
e
))
return
Response
({
"error"
:
str
(
e
.
detail
[
0
])},
status
=
status
.
HTTP_400_BAD_REQUEST
)
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
)
return
Response
(
status
=
status
.
HTTP_200_OK
)
def
partial_update
(
self
,
request
,
pk
):
def
partial_update
(
self
,
request
,
pk
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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