Fakultas Ilmu Komputer UI

tests.py 868 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from django.test import TestCase, Client
from .models import DietProfile

# Create your tests here.
class DietelaQuiz(TestCase):
    
    def setUp(self):
        self.c = Client()

    def test_diet_profile_saved(self):
        DietProfile.objects.create(
            nama="test", email="test@test.com", usia=20,
            berat_badan=60, tinggi_badan=172, jenis_kelamin=2,
            kondisi_khusus=1, aktif_badan=1, sayur_dimakan_sehari=1,
            buah_dimakan_sehari=1, gorengan_dimakan_sehari=1, cemilan_manis_dimakan_sehari=1,
            minuman_manis_diminum_sehari=1, makanan_kemasan_dimakan_sehari=1, makanan_besar_dimakan_sehari=1,
            cemilan_dimakan_sehari=1, jenis_makanan_pagi=1, kondisi_saat_ini=1,
            masalah_ingin_diselesaikan=1, masalah_kesehatan_dimiliki=1
        )
        self.assertEqual(DietProfile.objects.count(), 1)