Fakultas Ilmu Komputer UI

Commit c2326127 authored by fariqodri's avatar fariqodri
Browse files

[REFACTOR] add input possibilities

parent bafcb093
Pipeline #22002 failed with stages
in 180 minutes
......@@ -180,6 +180,7 @@ class VacancyTest(APITestCase):
superuser = User.objects.create_superuser('dummy.company', 'dummy.company@company.com', 'lalala123')
self.client.force_authenticate(user=superuser)
url_no_companies='/api/vacancies/'
response = self.client.get(url_no_companies, format='json')
self.assertEqual(dict(response.data)['count'], Vacancy.objects.count())
self.assertEqual(response.status_code, status.HTTP_200_OK)
......@@ -187,23 +188,27 @@ class VacancyTest(APITestCase):
new_user = User.objects.create_user('dummy.company3', 'dummy.company3@company.com', 'lalala123')
new_company = Company.objects.create(user=new_user, description="lalala", status=Company.VERIFIED, logo=None,
address=None)
url_a_company = '/api/vacancies/?company={}'.format(new_company.id)
response = self.client.get(url_a_company, format='json')
self.assertEqual(dict(response.data)['count'], 0)
self.assertEqual(response.status_code, status.HTTP_200_OK)
new_user2 = User.objects.create_user('dummy.companyzxc', 'dummy.companyzxc@company.com', 'lalala123')
new_company2 = Company.objects.create(user=new_user2, description="lalalaasdsad", status=Company.VERIFIED,
logo=None,
address=None)
open_time = datetime(2019, 10, 20)
close_time = datetime(2019, 12, 20)
vacancy1 = Vacancy.objects.create(company=new_company, verified=True, open_time=open_time,
description='', close_time=close_time, name='vacancy1')
vacancy2 = Vacancy.objects.create(company=new_company2, verified=True, open_time=open_time,
description='', close_time=close_time, name='vacancy2')
url_a_company = '/api/vacancies/?company={}'.format(new_company.id)
response = self.client.get(url_a_company, format='json')
vacancies = Vacancy.objects.filter(company__id__in=[new_company.id])
self.assertEqual(dict(response.data)['count'], 1)
self.assertEqual(response.status_code, status.HTTP_200_OK)
url_not_exist_company = '/api/vacancies/?company={}'.format(0)
response = self.client.get(url_not_exist_company, format='json')
self.assertEqual(dict(response.data)['count'], 0)
self.assertEqual(response.status_code, status.HTTP_200_OK)
def test_fail_on_unverified_user_vacancy_list(self):
url = '/api/vacancies/'
......
Markdown is supported
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