Fakultas Ilmu Komputer UI
Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
PMPL
Class Project
Kape
Commits
15d885c6
Commit
15d885c6
authored
Dec 06, 2019
by
fakhrilm
Browse files
membuat template test transcript success
parent
08f6be23
Pipeline
#26825
passed with stages
in 9 minutes and 27 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
core/tests/test_accounts.py
View file @
15d885c6
...
@@ -6,7 +6,8 @@ from django.core.exceptions import ValidationError
...
@@ -6,7 +6,8 @@ from django.core.exceptions import ValidationError
from
rest_framework
import
status
from
rest_framework
import
status
from
rest_framework.test
import
APITestCase
from
rest_framework.test
import
APITestCase
from
core.views.sso_login
import
get_access_token
,
get_riwayat_user
from
django.core
import
serializers
from
core.models.accounts
import
Student
try
:
try
:
from
StringIO
import
StringIO
## for Python 2
from
StringIO
import
StringIO
## for Python 2
...
@@ -511,6 +512,30 @@ class ResponseApiLoginCompany(APITestCase):
...
@@ -511,6 +512,30 @@ class ResponseApiLoginCompany(APITestCase):
self
.
assertTrue
(
"last_login"
in
response
.
data
.
keys
())
self
.
assertTrue
(
"last_login"
in
response
.
data
.
keys
())
class
TranscriptTest
(
APITestCase
):
class
TranscriptTest
(
APITestCase
):
# Belum bisa diimplementasikan karena untuk melihat transcript akun yang digunakan harus tercatat pada service API SSO.
# Implementasi fitur ini menggunakan access token yang langsung diambil dari API SSO.
'''
@requests_mock.Mocker()
def test_transcript_success(self, m):
mock_csui_oauth_verify(m)
mock_csui_ldap_student(m)
mock_csui_siak_student(m)
url = '/api/login/'
response = self.client.post(url, {'username': 'dummy.mahasiswa', 'password': 'lalala', 'login-type': 'sso-ui'},
format='json')
student_id = response.data.get('student').get('id')
student = Student.objects.all()
student.update(show_transcript=True)
url = '/api/students/' + str(student_id) + "/transcript/"
response = self.client.get(url)
self.fail()
'''
@
requests_mock
.
Mocker
()
@
requests_mock
.
Mocker
()
def
test_transcript_fail
(
self
,
m
):
def
test_transcript_fail
(
self
,
m
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment