Fakultas Ilmu Komputer UI

Commit 63144c3b authored by Joshua Casey's avatar Joshua Casey
Browse files

#23 tests for company applications and vacancies list api

parent cf25c39e
# __init__.py
from core.tests.test_accounts import LoginTests, RegisterTests
from core.tests.test_vacancies import ApplicationTests, BookmarkApplicationTests
from core.tests.test_vacancies import ApplicationTests, BookmarkApplicationTests, CompanyListsTests
......@@ -100,7 +100,7 @@ class BookmarkApplicationTests(APITestCase):
format='json')
student_id = response.data.get('student').get('id')
new_user = User.objects.create_user('dummy.company', 'dummy.company@company.com', 'lalala123')
new_user = User.objects.create_user('dummy.company2', 'dummy.compan2y@company.com', 'lalala123')
new_company = Company.objects.create(user=new_user, description="lalala",verified=True,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())
......@@ -111,3 +111,23 @@ class BookmarkApplicationTests(APITestCase):
url = '/api/students/' + str(student_id) + '/bookmarked-vacancies/' + str(new_vacancy.pk) + '/'
response = self.client.delete(url)
self.assertEqual(response.status_code, status.HTTP_200_OK)
class CompanyListsTests(APITestCase):
def test_company_vacancy_list_exist(self):
new_user = User.objects.create_user('dummy.company3', 'dummy.company3@company.com', 'lalala123')
new_company = Company.objects.create(user=new_user, description="lalala", verified=True, logo=None, address=None)
url = '/api/companies/' + str(new_company.pk) + '/vacancies'
response = self.client.post(url, format='json')
self.assertEqual(response.status_code, status.HTTP_200_OK)
def test_company_application_list_exist(self):
new_user = User.objects.create_user('dummy.company4', 'dummy.company4@company.com', 'lalala123')
new_company = Company.objects.create(user=new_user, description="lalala", verified=True, logo=None,
address=None)
url = '/api/companies/' + str(new_company.pk) + '/applications'
response = self.client.post(url, format='json')
self.assertEqual(response.status_code, status.HTTP_200_OK)
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