Fakultas Ilmu Komputer UI

Commit c3fd8ce8 authored by Endrawan Andika Wicaksana's avatar Endrawan Andika Wicaksana
Browse files

1606862740-236-Membuat validator untuk jumlah karyawan perusahaan

parent d4d9173f
# Generated by Django 2.2.8 on 2019-12-06 09:34
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0004_auto_20191206_1510'),
]
operations = [
migrations.AlterField(
model_name='company',
name='size',
field=models.IntegerField(default=1, validators=[django.core.validators.MinValueValidator(1)]),
),
]
......@@ -167,7 +167,7 @@ class Company(models.Model):
validators=[validate_image_file_extension])
address = models.CharField(max_length=1000, blank=True, null=True)
category = models.CharField(max_length=140, default="Belum ada kategori perusahaan")
size = models.CharField(max_length=10, default=0, null=True, blank=True)
size = models.IntegerField(default=1, validators=[MinValueValidator(1)])
website = models.CharField(max_length=100, default="Belum ada link website")
linkedin_url = models.URLField(max_length=200, blank=True, null=True)
......
......@@ -493,6 +493,12 @@ class ProfileUpdateTests(APITestCase):
response = self.client.patch(url, {'size': '1000'}, format='multipart')
self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED)
response = self.client.patch(url, {'size': '-1'}, format='multipart')
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
response = self.client.patch(url, {'size': 'tulisan'}, format='multipart')
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
response = self.client.patch(url, {'website': 'www.huehue.com'}, format='multipart')
self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED)
......
Markdown is supported
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