Fakultas Ilmu Komputer UI

Commit 3276a9b9 authored by Muhammad Ilham Peruzzi's avatar Muhammad Ilham Peruzzi
Browse files

1606823475-175

parent a5d987c7
from django.test import TestCase
from django.contrib.auth.models import User
from core.models.accounts import Company, Student, Supervisor
from core.serializers.accounts import StudentSerializer, StudentUpdateSerializer, CompanyUpdateSerializer
import datetime
class TestAccountSerializers(TestCase):
def test_accepted_no(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", birth_date=datetime.datetime.now())
self.assertEqual(StudentSerializer.get_accepted_no(student), 0)
def test_read_no(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", birth_date=datetime.datetime.now())
self.assertEqual(StudentSerializer.get_read_no(student), 0)
def test_student_update_serializers(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", birth_date=datetime.datetime.now())
self.assertEqual(StudentUpdateSerializer.to_representation(self, student),
{
'resume': None,
'email': student.user.email,
'phone_number': student.phone_number,
'gender': student.gender,
'region': student.region,
'photo': None,
'show_transcript': student.show_transcript,
'portfolio_link': student.portfolio_link,
'self_description': student.self_description,
'intro': student.intro,
'expected_salary': student.expected_salary,
'job_seeking_status': student.job_seeking_status,
'website_url': student.website_url,
'student_gpa': student.student_gpa,
'student_toefl':student.student_toefl,
'student_toefl_file': None,
'volunteer': student.volunteer,
'linkedin_url': student.linkedin_url,
'hackerrank_url': student.hackerrank_url,
'work_experience': student.work_experience,
'latest_work': student.latest_work,
'latest_work_desc': student.latest_work_desc,
'alamat': student.alamat,
'skills': student.skills,
'github_url': student.github_url,
'gitlab_url': student.gitlab_url,
'awards': student.awards,
'projects': student.projects,
'certification': student.certification,
'languages': student.languages,
'seminar': student.seminar,
'interests': student.interests,
'dependants': student.dependants,
'related_course':student.related_course,
'ielts':student.ielts,
})
def test_company_update_serializers(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.assertEqual(CompanyUpdateSerializer.to_representation(self, company),
{
'address': company.address,
'description': company.description,
'founded': company.founded,
'name': company.user.first_name,
'website': company.website,
'linkedin_url': company.linkedin_url,
'size': company.size,
})
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