Fakultas Ilmu Komputer UI

Commit f55e74cd authored by Muhammad Fakhrillah Abdul Azis's avatar Muhammad Fakhrillah Abdul Azis
Browse files

membuat test transcript student kondisi gagal

parent 075e1921
......@@ -6,6 +6,8 @@ from django.core.exceptions import ValidationError
from rest_framework import status
from rest_framework.test import APITestCase
from core.views.sso_login import get_access_token, get_riwayat_user
from StringIO import StringIO ## for Python 2
except ImportError:
......@@ -86,7 +88,6 @@ class LoginTests(APITestCase):
birth_day = (date.today() - timedelta(days=700))
self.assertEqual(1, get_current_age(birth_day))
class RegisterTests(APITestCase):
def test_create_and_recreate(self):
url = '/api/register/'
......@@ -487,7 +488,6 @@ 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)
class ResponseApiLoginCompany(APITestCase):
def setUp(self):
self.username = "fesbuk"
......@@ -509,3 +509,23 @@ class ResponseApiLoginCompany(APITestCase):
self.assertTrue("last_login" in response.data.keys())
class TranscriptTest(APITestCase):
def test_transcript_fail(self, m):
url = '/api/login/'
response = self.client.post(url, {'username': 'dummy.mahasiswa', 'password': 'lalala', 'login-type': 'sso-ui'},
student_id = response.data.get('student').get('id')
url = '/api/students/' + str(student_id) + "/transcript/"
response = self.client.get(url)
self.assertEqual(response.json()['name'], 'Dummy Mahasiswa')
self.assertEqual(response.json()['error'], 'student does not allow transcript to be shown')
\ No newline at end of file
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