Fakultas Ilmu Komputer UI

Commit 7a9f7d3b authored by Fajrin Kingwijati's avatar Fajrin Kingwijati
Browse files

Merge branch '1606837631-199' into 'master'

Add unit test for models/accounts.py

See merge request !231
parents 26246888 b1fd1143
Pipeline #26624 passed with stages
in 13 minutes and 32 seconds
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")
\ No newline at end of file
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