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
ppl-fasilkom-ui
2020
PPL-C
Diskominfo-D'Blood
Mantan Aab-D Blood
Commits
d8938beb
Commit
d8938beb
authored
Jun 02, 2020
by
Nabila Febri Viola
Browse files
[GREEN] Change acara donor factories to fit the new acara donor model
parent
66117196
Changes
1
Hide whitespace changes
Inline
Side-by-side
backend/acara_donor/factories.py
View file @
d8938beb
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'
)
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