Fakultas Ilmu Komputer UI

Commit a5d987c7 authored by Adib Yusril Wafi's avatar Adib Yusril Wafi
Browse files

Merge branch '1606837991-#224' into 'master'

1606837991 #224

See merge request !282
parents a6e57223 3acce334
Pipeline #26855 passed with stages
in 29 minutes and 5 seconds
...@@ -167,6 +167,28 @@ class ApplicationTests(APITestCase): ...@@ -167,6 +167,28 @@ class ApplicationTests(APITestCase):
format='json') format='json')
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) 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): class BookmarkApplicationTests(APITestCase):
@requests_mock.Mocker() @requests_mock.Mocker()
...@@ -496,6 +518,30 @@ class VacancyTest(APITestCase): ...@@ -496,6 +518,30 @@ class VacancyTest(APITestCase):
self.assertRaisesMessage(status.HTTP_400_BAD_REQUEST, self.assertRaisesMessage(status.HTTP_400_BAD_REQUEST,
date_validator(str(datetime.today()), str(datetime.today()))['status']) 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): class CompanyListsTests(APITestCase):
def test_company_vacancy_list(self): 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