Fakultas Ilmu Komputer UI

Commit f8469006 authored by addffa's avatar addffa
Browse files

[RED] membuat test hitung umur mustahik

parent de78763f
......@@ -3,6 +3,7 @@ import json
from datetime import date
from django.db.utils import IntegrityError
from django.test import TestCase
from django.utils import timezone
from graphene_django.utils.testing import GraphQLTestCase
from sizakat.schema import schema
......@@ -49,6 +50,13 @@ class MustahikModelTestCase(TestCase):
gender=Mustahik.Gender.PEREMPUAN
)
def test_calculate_mustahik_age(self):
mustahik = Mustahik.objects.get(no_ktp='31751234567890')
self.assertEqual(
mustahik.calculate_age(),
timezone.now().year - mustahik.birthdate.year
)
class MustahikGraphQLTestCase(GraphQLTestCase):
GRAPHQL_SCHEMA = schema
......
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