Fakultas Ilmu Komputer UI

Commit d8938beb authored by Nabila Febri Viola's avatar Nabila Febri Viola
Browse files

[GREEN] Change acara donor factories to fit the new acara donor model

parent 66117196
import factory
import dateutil.tz
from datetime import timedelta
from django.utils import timezone
from random import choice, randint
from acara_donor.models import AcaraDonor
from donor.models import JadwalDonor
from main.factories import UserFactory
......@@ -14,14 +17,27 @@ class AcaraDonorFactory(factory.DjangoModelFactory):
nomor = factory.Faker('uuid4')
user = factory.SubFactory(UserFactory)
status = factory.Faker('boolean', chance_of_getting_true=66)
nama_institusi = factory.Faker('company')
alamat_institusi = factory.Faker('address', locale=LOCALE)
alamat_lokasi_donor = factory.Faker('address', locale=LOCALE)
no_telp_kantor = factory.Faker('phone_number')
email_kantor = factory.Faker('company_email', locale=LOCALE)
no_telp_kantor = factory.Faker('phone_number')
nama_koor = factory.Faker('name', locale=LOCALE)
email_koor = factory.Faker('free_email', locale=LOCALE)
no_telp_koor = factory.Faker('phone_number')
waktu_donor = factory.Faker('future_datetime', tzinfo=dateutil.tz.gettz('Asia/Jakarta'))
kategori = factory.LazyAttribute(lambda _:
choice(JadwalDonor.Category.choices)[0])
alamat_lokasi_donor = factory.Faker('address', locale=LOCALE)
kecamatan = factory.LazyAttribute(lambda _:
choice(JadwalDonor.Kecamatan.choices)[0])
waktu_mulai = factory.LazyAttribute(lambda _: timezone.now()
+ timedelta(
days=randint(1, 66),
hours=randint(1, 23))) # NOSONAR
waktu_berakhir = factory.LazyAttribute(lambda t: t.waktu_mulai
+ timedelta(
hours=randint(2, 6))) # NOSONAR
perkiraan_jumlah_donor = factory.fuzzy.FuzzyInteger(low=33, high=666)
keterangan = factory.Faker('text')
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