Fakultas Ilmu Komputer UI

Commit 4f24a356 authored by emil farisan's avatar emil farisan
Browse files

create positive and negative test case

parent 1682b6a7
......@@ -152,6 +152,11 @@ class ProfileUpdateTests(APITestCase):
self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED)
self.assertEqual(response.data.get('linkedin_url'), 'https://www.linkedin.com/in/jojo/')
url = '/api/students/' + str(student_id) + "/profile/"
response = self.client.patch(url, {'hackerrank_url': 'https://www.hackerrank.com/jane'}, format='multipart')
self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED)
self.assertEqual(response.data.get('hackerrank_url'), 'https://www.hackerrank.com/jane')
response = self.client.patch(url, {'region': 'Indonesia'}, format='multipart')
self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED)
self.assertEqual(response.data.get('region'), 'Indonesia')
......@@ -172,6 +177,10 @@ class ProfileUpdateTests(APITestCase):
response = self.client.patch(url, {'linkedin_url': 'this is not valid url'}, format='multipart')
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
url = '/api/students/' + str(student_id) + "/profile/"
response = self.client.patch(url, {'hackerrank_url': 'this is not valid url'}, format='multipart')
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
new_user = User.objects.create_user('dummy.student2', 'dummy.student@student.com', 'lalala123')
new_student = Student.objects.create(user=new_user, npm="1212121212")
......
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