Fakultas Ilmu Komputer UI

Commit 3acce334 authored by Adib Yusril Wafi's avatar Adib Yusril Wafi
Browse files

1606837991 #224

parent a6e57223
......@@ -167,6 +167,28 @@ class ApplicationTests(APITestCase):
format='json')
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
def test_get_applicant_transcript_denied(self):
company_user = User.objects.create_user('dummy.company', 'dummy.company@company.com', 'lalala123')
student_user = User.objects.create_user('dummy.student', 'dummy.student@student.com', 'lalala123')
self.client.force_authenticate(student_user)
self.client.force_authenticate(company_user)
new_student = Student.objects.create(user=student_user, npm=1234123412)
new_company = Company.objects.create(user=company_user, description="lalala", status=Company.VERIFIED, logo=None,
address=None)
new_vacancy = Vacancy.objects.create(company=new_company, verified=True, open_time=datetime.fromtimestamp(0),
description="lalala", close_time=datetime.today(),
max_accepted_applicants=3, working_period="3 Bulan")
new_application = Application.objects.create(student=new_student, vacancy=new_vacancy, cover_letter="lorem ipsum")
url = '/api/applications/' + str(new_application.pk) + '/transcript/'
response = self.client.get(url, format='json')
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(response.json()['error'], 'student does not allow transcript to be shown')
class BookmarkApplicationTests(APITestCase):
@requests_mock.Mocker()
......@@ -496,6 +518,30 @@ class VacancyTest(APITestCase):
self.assertRaisesMessage(status.HTTP_400_BAD_REQUEST,
date_validator(str(datetime.today()), str(datetime.today()))['status'])
def test_count_vacancy(self):
company_user = User.objects.create_user('dummy.company', 'dummy.company@company.com', 'lalala123')
student_user = User.objects.create_user('dummy.student', 'dummy.student@student.com', 'lalala123')
self.client.force_authenticate(company_user)
new_company = Company.objects.create(user=company_user, description="lalala", status=Company.VERIFIED, logo=None,
address=None)
new_student = Student.objects.create(user=student_user, npm=1234123412)
new_vacancy = Vacancy.objects.create(company=new_company, verified=True, open_time=datetime.fromtimestamp(0),
description="lalala", close_time=datetime.today(),
max_accepted_applicants=3, working_period="3 Bulan")
Application.objects.create(student=new_student, vacancy=new_vacancy, cover_letter="lorem ipsum")
url = '/api/vacancies/' + str(new_vacancy.pk) + '/count/'
response = self.client.get(url, format='json')
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(response.json()['count'], 1)
self.assertEqual(response.json()['count_new'], 1)
class CompanyListsTests(APITestCase):
def test_company_vacancy_list(self):
......
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