Fakultas Ilmu Komputer UI

test_account_models.py 1.43 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from django.test import TestCase
from django.contrib.auth.models import User
from core.models.accounts import Company, Student, Supervisor

class CompanyTest(TestCase):

    def test_company_creation(self):
        user = User.objects.create_user('dummy.login.company', 'dummy.login.company@company.com', 'lalala123')
        company = Company.objects.create(user=user, description="lalalala", status=Company.VERIFIED, logo=None, address=None, category="perusahaan listrik", size="20", website="www.www", linkedin_url=None)
        self.assertTrue(isinstance(company, Company))
        self.assertEqual(company.name.title(), "Dummy.Login.Company")

    def test_supervisor_creation(self):
        user = User.objects.create_user('dummy.login.supervisor', 'dummy.login.supervisor@supervisor.com', 'lalala123')
        supervisor = Supervisor.objects.create(user=user, nip=100000000)
        self.assertTrue(isinstance(supervisor, Supervisor))
        self.assertEqual(supervisor.name.title(), "Dummy.Login.Supervisor")

    def test_student_creation(self):
        user = User.objects.create_user('dummy.login.student', 'dummy.login.student@student.com', 'lalala123')
        student = Student.objects.create(user=user, npm=1606837631, resume=None, sertifikat=None, phone_number="081291693790", gender="laki-laki", birth_place="Jakarta")
        self.assertTrue(isinstance(student, Student))
        self.assertEqual(student.name.title(), "Dummy.Login.Student")