Fakultas Ilmu Komputer UI

Commit 007a0fda authored by REGENSA ANNAAFII TJAHJANTO's avatar REGENSA ANNAAFII TJAHJANTO
Browse files

1606875926 106-Fitur menampilkan error validasi waktu buka lowongan pekerjaan...

1606875926 106-Fitur menampilkan error validasi waktu buka lowongan pekerjaan ketika waktu buka dan waktu tutup lowongan sama
parent ab81f5bb
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2019-11-09 15:49
from __future__ import unicode_literals
import core.models.accounts
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='company',
name='category',
field=models.CharField(default='Belum ada kategori perusahaan', max_length=140),
),
migrations.AlterField(
model_name='company',
name='website',
field=models.CharField(default='Belum ada link website', max_length=100),
),
migrations.AlterField(
model_name='feedback',
name='title',
field=models.CharField(blank=True, default='', max_length=100),
),
migrations.AlterField(
model_name='reasonrejected',
name='reason',
field=models.TextField(default='Tidak memenuhi kualifikasi perusahaan.'),
),
migrations.AlterField(
model_name='student',
name='phone_number',
field=models.CharField(blank=True, db_index=True, max_length=100, null=True, validators=[django.core.validators.RegexValidator('^0\\d{1,11}$')]),
),
migrations.AlterField(
model_name='student',
name='photo',
field=models.FileField(blank=True, null=True, upload_to=core.models.accounts.get_student_photo_file_path, validators=[django.core.validators.FileExtensionValidator(['jpg', 'jpeg', 'png'])]),
),
migrations.AlterField(
model_name='student',
name='resume',
field=models.FileField(blank=True, null=True, upload_to=core.models.accounts.get_student_resume_file_path, validators=[django.core.validators.FileExtensionValidator(['pdf'])]),
),
migrations.AlterField(
model_name='student',
name='student_gpa',
field=models.FloatField(blank=True, db_column='student_gpa', default=1.0, null=True),
),
]
......@@ -266,6 +266,7 @@ class CreateAndUpdateVacancyTest(APITestCase):
'max_accepted_applicants': 3, 'working_period': '3 Bulan'}, format='json')
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
self.assertEqual(response.json()['error'], 'Waktu tutup dan buka lowongan tidak boleh sama!')
vacancies = Vacancy.objects.count()
self.assertEqual(vacancies, 0)
......@@ -304,6 +305,7 @@ class CreateAndUpdateVacancyTest(APITestCase):
'max_accepted_applicants': 3, 'working_period': '3 Bulan'}, format='json')
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
self.assertEqual(response.json()['error'], 'Waktu tutup dan buka lowongan tidak boleh sama!')
def test_update_vacancy_one_same_day_with_amount_failed(self):
superuser = User.objects.create_superuser('dummy.company', 'dummy.company@company.com', 'lalala123')
......
......@@ -30,7 +30,8 @@ def date_validator(open_time, close_time):
return {'is_valid': False, 'error': 'Waktu tutup lowongan harus lebih dari waktu buka lowongan!',
'status': status.HTTP_400_BAD_REQUEST}
elif close_time == open_time:
raise ValidationError('Waktu tutup dan buka lowongan tidak boleh sama!')
return {'is_valid': False, 'error': 'Waktu tutup dan buka lowongan tidak boleh sama!',
'status': status.HTTP_400_BAD_REQUEST}
else:
return {'is_valid': True, 'error': '', 'status': status.HTTP_200_OK}
......
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