Fakultas Ilmu Komputer UI

Commit 02d52dd7 authored by Ryan Karyadiputera's avatar Ryan Karyadiputera
Browse files

test

parent 3903c363
Pipeline #73841 passed with stages
in 9 minutes and 10 seconds
......@@ -42,10 +42,7 @@ POSTGRES_DB=postgres_db_name
```
### __How To Run on Local Development__
1. Buat .env di folder sip/settings/ dengan secret key-nya. Tambahin line ini di file-nya:
```bash
DJANGO_SECRET_KEY="s3cr3t_k3y_c4nn0t_h4ck3d_by_l33t_1337"
```
1. Buat .env di folder sip/settings/ dengan secret key-nya
2. Lakukan makemigrations dan migrate
```bash
python manage.py makemigrations --settings=sip.settings.dev
......@@ -57,6 +54,5 @@ POSTGRES_DB=postgres_db_name
```
### __Pipelines and Coverage__
[![pipeline status](https://gitlab.cs.ui.ac.id/ppl-fasilkom-ui/2021/BB/departemen-ilmu-kesejahteraan-sosial-ui-sistem-informasi-penilaian-dan-database-praktikum-i-dan-ii/praktikum-backend/badges/staging/pipeline.svg)](https://gitlab.cs.ui.ac.id/ppl-fasilkom-ui/2021/BB/departemen-ilmu-kesejahteraan-sosial-ui-sistem-informasi-penilaian-dan-database-praktikum-i-dan-ii/praktikum-backend/commits/staging/)
[![coverage report](https://gitlab.cs.ui.ac.id/ppl-fasilkom-ui/2021/BB/departemen-ilmu-kesejahteraan-sosial-ui-sistem-informasi-penilaian-dan-database-praktikum-i-dan-ii/praktikum-backend/badges/staging/coverage.svg)](https://gitlab.cs.ui.ac.id/ppl-fasilkom-ui/2021/BB/departemen-ilmu-kesejahteraan-sosial-ui-sistem-informasi-penilaian-dan-database-praktikum-i-dan-ii/praktikum-backend/commits/staging/)
[![pipeline status](https://gitlab.cs.ui.ac.id/ppl-fasilkom-ui/itproject-2020/group-a/praktikum-backend/badges/staging/pipeline.svg)](https://gitlab.cs.ui.ac.id/ppl-fasilkom-ui/itproject-2020/group-a/praktikum-backend) [![coverage report](https://gitlab.cs.ui.ac.id/ppl-fasilkom-ui/itproject-2020/group-a/praktikum-backend/badges/staging/coverage.svg)](https://gitlab.cs.ui.ac.id/ppl-fasilkom-ui/itproject-2020/group-a/praktikum-backend)
......@@ -557,11 +557,17 @@ class SSOUITest(TestCase):
supervisor_sekolah=None
)
# def test_login_url_exists(self):
# """Test if login url exists and redirects to CAS server (response code 302)."""
# response = self.client.get(reverse('authentication:login-sivitas'))
# self.assertEqual(response.status_code, 302)
# self.assertTrue(response.url.startswith(settings.CAS_SERVER_URL))
def test_login_url_exists(self):
"""Test if login url exists and redirects to CAS server (response code 302)."""
response = self.client.get(reverse('authentication:login-sivitas'))
self.assertEqual(response.status_code, 302)
self.assertTrue(response.url.startswith(settings.CAS_SERVER_URL))
def test_logout_url_exists(self):
"""Test if logout url exists and redirects to CAS server (response code 302)."""
response = self.client.get(reverse('authentication:logout'))
self.assertEqual(response.status_code, 302)
self.assertTrue(response.url.startswith(settings.CAS_SERVER_URL))
# def test_profile_can_save_attributes_if_user_mahasiswa_not_yet_registered(self):
# """Test if Profile Mahasiswa model can save the attributes from CAS."""
......
......@@ -5,8 +5,7 @@ from django.urls import include, path
app_name = 'authentication'
urlpatterns = [
path('login/sivitas/', APILoginView.as_view(), name='login-sivitas'),
# path('logout/', APILogoutView.as_view(), name='logout'),
path('logout/', views.ManualLogoutView.as_view(), name='logout'),
path('logout/', APILogoutView.as_view(), name='logout'),
path('register/supervisor-lembaga/', views.UserRegistrationView.as_view(), name='register-supervisor-lembaga'),
path('login/supervisor-lembaga/', views.UserLoginView.as_view(), name='login-supervisor-lembaga'),
path('register/supervisor-lembaga/', views.UserRegistrationView.as_view(), name='register-supervisor-lembaga'),
......@@ -20,5 +19,5 @@ urlpatterns = [
path('profile/administrator', views.UserProfileAdministratorView.as_view(), name='profile-administrator'),
path('profile/user', views.UserProfileUserView.as_view(), name='profile-user'),
path('periode/list', views.PeriodeListView.as_view(), name='periode-list'),
path('login/sso/', views.ManualSSOLoginView.as_view(), name='login-sso'),
path('login/sso/', views.ManualSSOLoginView.as_view(), name='login-sso')
]
......@@ -21,10 +21,8 @@ from .serializers import (
AdministratorLoginSerializer
)
from .role import Role
from datetime import datetime
from django.contrib.auth.decorators import login_required
from django.http import JsonResponse, HttpResponseRedirect
from django.contrib.auth.models import update_last_login
from django.http import JsonResponse
from django.shortcuts import render
from rest_framework import status
from rest_framework.decorators import api_view
......@@ -107,14 +105,6 @@ class ManualSSOLoginView(RetrieveAPIView):
return Response(response, status=status.HTTP_200_OK)
class ManualLogoutView(RetrieveAPIView):
permission_classes = (AllowAny,)
def get(self, request):
update_last_login(datetime.now(), request.user)
return HttpResponseRedirect("http://sipraktikum-frontend-2020-a.herokuapp.com")
class UserProfileMahasiswaView(RetrieveAPIView): # pragma: no cover
permission_classes = (IsAuthenticated,)
......
This diff is collapsed.
......@@ -214,14 +214,6 @@ def get_list_laporan_praktikum_detail(request):
response_field[1]: status_code,
response_field[2]: error_message_404_praktikum
}
except TemplateBorangPenilaianPraktikum.DoesNotExist:
status_code = status.HTTP_404_NOT_FOUND
response = {
response_field[0]: 'False',
response_field[1]: status_code,
response_field[2]: "Your Supervisor Sekolah hasn't been uploaded the Template Borang"
}
return Response(response, status=status_code)
......
......@@ -2,3 +2,9 @@ DJANGO_SECRET_KEY
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
AWS_STORAGE_BUCKET_NAME
SQL_ENGINE
SQL_DATABASE
SQL_USER
SQL_PASSWORD
SQL_HOST
SQL_PORT
\ No newline at end of file
......@@ -105,9 +105,13 @@ REST_FRAMEWORK = {
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
"default": {
"ENGINE": env("SQL_ENGINE"),
"NAME": env("SQL_DATABASE"),
"USER": env("SQL_USER"),
"PASSWORD": env("SQL_PASSWORD"),
"HOST": env("SQL_HOST"),
"PORT": env("SQL_PORT"),
}
}
......
......@@ -120,7 +120,7 @@ if os.environ.get('DATABASE_URL') is not None:
# DOMAIN='https://ppl2020a1.cs.ui.ac.id'
# else:
# DOMAIN='http://sipraktikum-backend.herokuapp.com'
# DOMAIN='http://si-praktikum-backend.herokuapp.com'
# Password validation
......
......@@ -11,6 +11,6 @@ import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'sip.settings')
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'sip.settings.production')
application = get_wsgi_application()
......@@ -28,4 +28,4 @@ sonar.scm.provider=git
sonar.sourceEncoding=UTF-8
## Branch analysis
sonar.branch.name=$CI_COMMIT_REF_NAME
\ No newline at end of file
##sonar.branch.name=$CI_COMMIT_REF_NAME
\ 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