Fakultas Ilmu Komputer UI

Commit d82d6ddb authored by Ryan Karyadiputera's avatar Ryan Karyadiputera
Browse files

test3

parent 11856a6d
Pipeline #76867 passed with stages
in 8 minutes and 8 seconds
stages:
- test
- flake8
- build
# - sonarqube
- deploy
variables:
DOCKER_HOST: tcp://docker:2375
DOCKER_TLS_CERTDIR: ""
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
DOCKER_DRIVER: overlay2
image: python:latest
......@@ -25,6 +30,65 @@ before_script:
- echo "AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY" >> sip/settings/.env
- echo "AWS_STORAGE_BUCKET_NAME=$AWS_STORAGE_BUCKET_NAME" >> sip/settings/.env
dev-test:
stage: test
script:
- python3 manage.py collectstatic --settings=sip.settings.staging --no-input
- python3 manage.py makemigrations --settings=sip.settings.dev
- python3 manage.py migrate --settings=sip.settings.dev
- python3 manage.py test --settings=sip.settings.dev
only:
- development
- /^.*PBI-.*$/
staging-test:
stage: test
script:
- python3 manage.py collectstatic --settings=sip.settings.staging --no-input
- python3 manage.py makemigrations --settings=sip.settings.staging
- python3 manage.py migrate --settings=sip.settings.staging
- python3 manage.py test --settings=sip.settings.staging
only:
- staging
lint:
stage: flake8
script:
- flake8
allow_failure: true
except:
- CI-CD
# sonarqube:
# image: nuga99/sonar-scanner-python
# stage: sonarqube
# cache:
# key: sonarqube
# paths:
# - .cache/pip
# before_script:
# - python3 -V
# - pip3 install -r requirements.txt
# - echo "DJANGO_SECRET_KEY=$DJANGO_SECRET_KEY" > sip/settings/.env
# - echo "AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID" >> sip/settings/.env
# - echo "AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY" >> sip/settings/.env
# - echo "AWS_STORAGE_BUCKET_NAME=$AWS_STORAGE_BUCKET_NAME" >> sip/settings/.env
# script:
# - if [[ $CI_COMMIT_REF_NAME == staging ]]; then ENVIRON="sip.settings.staging"; else ENVIRON="sip.settings.dev"; fi
# - coverage run --omit='manage.py,**/venv/*,**/python3*/**,core/**,laporan_praktikum/error_message/**,laporan_praktikum/custom_module/**,authentication/cas_wrapper.py,/usr/**' manage.py test --settings=${ENVIRON}
# - coverage report -m
# - coverage xml -i
# - sonar-scanner
# -Dsonar.host.url=https://pmpl.cs.ui.ac.id/sonarqube
# -Dsonar.projectKey=$SONARQUBE_PROJECT_KEY
# -Dsonar.login=$SONARQUBE_TOKEN
# -Dsonar.branch.name=$CI_COMMIT_REF_NAME
# only:
# - master
# - staging
# - development
# - /^.*PBI-.*$/
heroku-deploy:
image: ruby:2.4
stage: deploy
......
......@@ -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)
......@@ -89,7 +89,6 @@ class Mahasiswa(models.Model):
faculty = models.CharField('faculty', max_length=128, blank=True)
major = models.CharField('major', max_length=128, blank=True)
program = models.CharField('program', max_length=128, blank=True)
lastLogin = models.CharField('last login', max_length=128, blank=True)
periode = models.ForeignKey(Periode, related_name="periode", on_delete=models.CASCADE, null=True, blank=True)
supervisor_sekolah = models.ForeignKey(SupervisorSekolah, related_name='mahasiswa', \
to_field='user', on_delete=models.CASCADE, null=True, blank=True)
......
......@@ -12,6 +12,7 @@ from lembaga.models import (
Institusi,
Tema,
Lembaga,
LingkupKerja,
)
from .serializers import (
UserSerializer,
......@@ -107,6 +108,11 @@ class ModelsTest(TestCase):
tema = Tema.objects.create(
nama="testing"
)
lingkup_kerja = LingkupKerja.objects.create(
nama="testing"
)
self.lembaga = Lembaga.objects.create(
nama="testing",
jenis_pelayanan="testing",
......@@ -118,6 +124,7 @@ class ModelsTest(TestCase):
beneficaries="test_beneficaries"
)
self.lembaga.lingkup_kerja.add(lingkup_kerja)
self.lembaga.gambar = self.get_image_file()
self.lembaga.save()
......@@ -293,6 +300,10 @@ class SerializersTest(TestCase):
nama="testing"
)
lingkup_kerja = LingkupKerja.objects.create(
nama="testing"
)
self.lembaga = Lembaga.objects.create(
nama="testing",
jenis_pelayanan="testing",
......@@ -304,6 +315,7 @@ class SerializersTest(TestCase):
alamat="test_alamat"
)
self.lembaga.lingkup_kerja.add(lingkup_kerja)
self.lembaga.gambar = self.get_image_file()
self.lembaga.save()
......@@ -545,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."""
......@@ -708,6 +726,10 @@ class AuthenticationJSONWebTokenTest(APITestCase):
nama="testing"
)
lingkup_kerja = LingkupKerja.objects.create(
nama="testing"
)
self.lembaga = Lembaga.objects.create(
nama="testing",
jenis_pelayanan="testing",
......@@ -719,6 +741,7 @@ class AuthenticationJSONWebTokenTest(APITestCase):
alamat="test_alamat"
)
self.lembaga.lingkup_kerja.add(lingkup_kerja)
self.lembaga.gambar = self.get_image_file()
self.lembaga.save()
......
......@@ -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://ppl-berkah.herokuapp.com/")
class UserProfileMahasiswaView(RetrieveAPIView): # pragma: no cover
permission_classes = (IsAuthenticated,)
......
from django.db import models
from lembaga.models import Lembaga
from lembaga.models import Lembaga, LingkupKerja
from authentication.models import Administrator, KoordinatorKuliah, Mahasiswa, \
SupervisorLembaga, SupervisorSekolah
from django.core.files.storage import FileSystemStorage
......
from laporan_praktikum.models import Praktikum, KelolaLaporanPraktikum, MahasiswaPraktikum
from authentication.models import Mahasiswa, SupervisorLembaga, SupervisorSekolah, User, Periode
from lembaga.models import Lembaga, Tema, Institusi
from lembaga.models import Lembaga, Tema, Institusi, LingkupKerja
from django.test import TestCase
from django.core.files import File
from io import BytesIO
......@@ -91,6 +91,8 @@ class SupervisorSekolahDashboardAPITest(APITestCase):
Institusi
), tema=mixer.blend(
Tema
), lingkup_kerja=mixer.blend(
LingkupKerja
), gambar=self.get_image_file()
), user=mixer.blend(User)
)
......
......@@ -15,7 +15,7 @@ from laporan_praktikum.models import (
from laporan_praktikum.serializers import (
RiwayatLaporanPraktikumMahasiswaSerializer
)
from lembaga.models import Lembaga, Tema, Institusi
from lembaga.models import Lembaga, Tema, Institusi, LingkupKerja
from laporan_praktikum.models import LaporanAkhirPraktikum
from django.test import TestCase
......@@ -365,6 +365,8 @@ class PeriodeAPITest(APITestCase):
Institusi
), tema=mixer.blend(
Tema
), lingkup_kerja=mixer.blend(
LingkupKerja
), gambar=self.get_image_file()
), user=mixer.blend(
User
......@@ -485,6 +487,8 @@ class KoordinatorKuliahDashboardAPITest(APITestCase):
Institusi
), tema=mixer.blend(
Tema
), lingkup_kerja=mixer.blend(
LingkupKerja
), gambar=self.get_image_file()
), user=mixer.blend(
User
......@@ -855,7 +859,9 @@ class AdministratorDashboardAPITest(APITestCase):
Institusi
), tema=mixer.blend(
Tema
),
), lingkup_kerja=mixer.blend(
LingkupKerja
)
), user=mixer.blend(
User,
username="username2",
......
......@@ -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)
......
......@@ -5,4 +5,4 @@ from lembaga import models
admin.site.register(models.Lembaga)
admin.site.register(models.Institusi)
admin.site.register(models.Tema)
admin.site.register(models.ErrorMessage)
admin.site.register(models.LingkupKerja)
......@@ -20,6 +20,13 @@ class Migration(migrations.Migration):
('nama', models.CharField(max_length=255)),
],
),
migrations.CreateModel(
name='LingkupKerja',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('nama', models.CharField(max_length=255)),
],
),
migrations.CreateModel(
name='Tema',
fields=[
......@@ -39,6 +46,7 @@ class Migration(migrations.Migration):
('alamat', models.CharField(max_length=1024)),
('praktikum_ke', models.IntegerField()),
('institusi', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='lembaga.Institusi')),
('lingkup_kerja', models.ManyToManyField(related_name='lembaga', to='lembaga.LingkupKerja')),
('tema', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='lembaga.Tema')),
],
),
......
......@@ -15,6 +15,11 @@ class Migration(migrations.Migration):
name='nama',
field=models.CharField(max_length=255, unique=True),
),
migrations.AlterField(
model_name='lingkupkerja',
name='nama',
field=models.CharField(max_length=255, unique=True),
),
migrations.AlterField(
model_name='tema',
name='nama',
......
......@@ -20,6 +20,14 @@ class Tema(models.Model):
return self.nama
class LingkupKerja(models.Model):
""" Models for Lingkup Kerja """
nama = models.CharField(max_length=255, unique=True)
def __str__(self):
return self.nama
def upload_location(instance, filename):
_, extension = filename.split('.')
return '%s.%s' % (instance.nama, extension)
......@@ -28,6 +36,7 @@ def upload_location(instance, filename):
class Lembaga(models.Model):
""" Models for Lembaga """
nama = models.CharField(max_length=255)
lingkup_kerja = models.ManyToManyField(LingkupKerja, related_name="lembaga")
jenis_pelayanan = models.CharField(max_length=255)
institusi = models.ForeignKey(Institusi, on_delete=models.CASCADE)
tema = models.ForeignKey(Tema, on_delete=models.CASCADE)
......@@ -38,9 +47,3 @@ class Lembaga(models.Model):
def __str__(self):
return self.nama
class ErrorMessage(models.Model):
""" Models for Error Messages """
def not_found(self):
return "tidak ditemukan"
from rest_framework import serializers
from lembaga.models import Lembaga, Institusi, Tema, ErrorMessage
from lembaga.models import Lembaga, Institusi, Tema, LingkupKerja
from rest_framework.exceptions import NotFound
from drf_extra_fields.fields import Base64ImageField
......@@ -22,8 +22,18 @@ class TemaSerializer(serializers.ModelSerializer):
}
class LingkupKerjaSerializer(serializers.ModelSerializer):
class Meta:
model = LingkupKerja
fields = '__all__'
extra_kwargs = {
'nama': {'validators': []},
}
class LembagaSerializer(serializers.ModelSerializer):
tema = TemaSerializer()
lingkup_kerja = LingkupKerjaSerializer(many=True)
institusi = InstitusiSerializer()
class Meta:
......@@ -41,18 +51,27 @@ class LembagaSerializer(serializers.ModelSerializer):
nama_tema = validated_data.pop('tema')['nama']
error = ErrorMessage
try:
tema = Tema.objects.get(nama=nama_tema)
except Tema.DoesNotExist:
raise NotFound(detail="Tema dengan nama " + str(nama_tema) + ErrorMessage.not_found(error))
raise NotFound(detail="Tema dengan nama " + str(nama_tema) + " tidak ditemukan")
nama_lingkup_kerja = validated_data.pop('lingkup_kerja')
final_query = []
for lingkup in nama_lingkup_kerja:
try:
lingkup_kerja = LingkupKerja.objects.get(nama=lingkup["nama"])
except LingkupKerja.DoesNotExist:
raise NotFound(detail="Lingkup kerja dengan nama " + str(lingkup["nama"]) + " tidak ditemukan")
final_query.append(lingkup_kerja)
nama_institusi = validated_data.pop('institusi')['nama']
try:
institusi = Institusi.objects.get(nama=nama_institusi)
except Institusi.DoesNotExist:
raise NotFound(detail="Institusi dengan nama " + str(nama_institusi) + ErrorMessage.not_found(error))
raise NotFound(detail="Institusi dengan nama " + str(nama_institusi) + " tidak ditemukan")
lembaga = Lembaga()
lembaga.nama = nama
......@@ -66,6 +85,8 @@ class LembagaSerializer(serializers.ModelSerializer):
lembaga.save()
lembaga.lingkup_kerja.set(final_query)
return lembaga
def update(self, lembaga, validated_data):
......@@ -77,18 +98,27 @@ class LembagaSerializer(serializers.ModelSerializer):
alamat = validated_data.pop('alamat')
nama_tema = validated_data.pop('tema')['nama']
error = ErrorMessage
try:
tema = Tema.objects.get(nama=nama_tema)
except Tema.DoesNotExist:
raise NotFound(detail="Tema dengan nama " + str(nama_tema) + ErrorMessage.not_found(error))
raise NotFound(detail="Tema dengan nama " + str(nama_tema) + " tidak ditemukan")
nama_lingkup_kerja = validated_data.pop('lingkup_kerja')
final_query = []
for lingkup in nama_lingkup_kerja:
try:
lingkup_kerja = LingkupKerja.objects.get(nama=lingkup["nama"])
except LingkupKerja.DoesNotExist:
raise NotFound(detail="Lingkup kerja dengan nama " + str(lingkup["nama"]) + " tidak ditemukan")
final_query.append(lingkup_kerja)
nama_institusi = validated_data.pop('institusi')['nama']
try:
institusi = Institusi.objects.get(nama=nama_institusi)
except Institusi.DoesNotExist:
raise NotFound(detail="Institusi dengan nama " + str(nama_institusi) + ErrorMessage.not_found(error))
raise NotFound(detail="Institusi dengan nama " + str(nama_institusi) + " tidak ditemukan")
lembaga.nama = nama
lembaga.jenis_pelayanan = jenis_pelayanan
......@@ -101,4 +131,8 @@ class LembagaSerializer(serializers.ModelSerializer):
lembaga.save()
lembaga.lingkup_kerja.clear()
lembaga.lingkup_kerja.set(final_query)
return lembaga
""" This module test the functionality of the module """
from django.test import TestCase
from .models import Lembaga, Tema, Institusi
from .models import Lembaga, Tema, Institusi, LingkupKerja
from .serializers import LembagaSerializer, InstitusiSerializer, TemaSerializer
from django.urls import reverse
from rest_framework.test import APITestCase, APIClient, APIRequestFactory
......@@ -27,12 +27,15 @@ class BaseViewTest(APITestCase):
def setUp(self):
tema = Tema.objects.create(nama="test_tema")
institusi = Institusi.objects.create(nama="test_institusi")
lingkup_kerja1 = LingkupKerja.objects.create(nama="test_lingkup_kerja1")
lingkup_kerja2 = LingkupKerja.objects.create(nama="test_lingkup_kerja2")
lembaga1 = Lembaga.objects.create(nama="test_nama",
jenis_pelayanan="test_pelayanan",
deskripsi_singkat="test_deskripsi",
tema=tema, institusi=institusi,
praktikum_ke=1, beneficaries="test_beneficaries",
alamat="test_alamat")
lembaga1.lingkup_kerja.set([lingkup_kerja1, lingkup_kerja2])
lembaga1.gambar = self.get_image_file()
lembaga1.save()
lembaga2 = Lembaga.objects.create(nama="test_nama1",
......@@ -41,6 +44,7 @@ class BaseViewTest(APITestCase):
tema=tema, institusi=institusi,
praktikum_ke=1, beneficaries="test_beneficaries",
alamat="test_alamat")
lembaga2.lingkup_kerja.set([lingkup_kerja1, lingkup_kerja2])
lembaga2.gambar = self.get_image_file()
lembaga2.save()
lembaga3 = Lembaga.objects.create(nama="test_nama2",
......@@ -49,6 +53,7 @@ class BaseViewTest(APITestCase):
tema=tema, institusi=institusi,
praktikum_ke=1, beneficaries="test_beneficaries",
alamat="test_alamat")
lembaga3.lingkup_kerja.set([lingkup_kerja1, lingkup_kerja2])
lembaga3.gambar = self.get_image_file()
lembaga3.save()
......@@ -59,6 +64,8 @@ class LembagaFunctionality(BaseViewTest):
""" Test Models Lembaga Field """
test_lembaga = Lembaga.objects.get(nama="test_nama")
tema = Tema.objects.get(nama="test_tema")
lingkup_kerja1 = LingkupKerja.objects.get(nama="test_lingkup_kerja1")
lingkup_kerja2 = LingkupKerja.objects.get(nama="test_lingkup_kerja2")
institusi = Institusi.objects.get(nama="test_institusi")
self.assertEqual(str(test_lembaga), 'test_nama')
self.assertEqual(test_lembaga.jenis_pelayanan, 'test_pelayanan')
......@@ -68,6 +75,8 @@ class LembagaFunctionality(BaseViewTest):
self.assertEqual(test_lembaga.beneficaries, "test_beneficaries")
self.assertEqual(str(test_lembaga.tema), str(tema))
self.assertEqual(str(test_lembaga.institusi), str(institusi))
self.assertEqual(str(test_lembaga.lingkup_kerja.get(nama="test_lingkup_kerja1")), str(lingkup_kerja1))
self.assertEqual(str(test_lembaga.lingkup_kerja.get(nama="test_lingkup_kerja2")), str(lingkup_kerja2))
def test_get_all_lembaga(self):
"""
......@@ -88,6 +97,7 @@ class LembagaFunctionality(BaseViewTest):
"tema": {
"nama": "test_tema"
},
"lingkup_kerja": [{"nama": "test_lingkup_kerja1"}],
"institusi": {
"nama": "test_institusi"
},
......@@ -103,6 +113,7 @@ class LembagaFunctionality(BaseViewTest):
"tema": {
"nama": "asal"
},
"lingkup_kerja": [{"nama": "test_lingkup_kerja1"}],
"institusi": {
"nama": "test_institusi"
},
......@@ -118,6 +129,7 @@ class LembagaFunctionality(BaseViewTest):
"tema": {
"nama": "test_tema"
},
"lingkup_kerja": [{"nama": "test_lingkup_kerja1"}],
"institusi": {
"nama": "asal"
},
......@@ -129,6 +141,21 @@ class LembagaFunctionality(BaseViewTest):
"alamat": "test_alamat"
}
json_no_lingkup_kerja = {
"tema": {
"nama": "test_tema"
},
"lingkup_kerja": [{"nama": "asal"}],
"institusi": {
"nama": "test_institusi"
},
"nama": "hom",
"jenis_pelayanan": "pim",
"deskripsi_singkat": "pa",
"praktikum_ke": 1,
"beneficaries": "test_beneficaries",
"alamat": "test_alamat"
}
view = LembagaView.as_view(actions={"post": "create", "put": "update"})
request = factory.post('/api/v1/lembaga/posts/', json, format='json')
......@@ -140,6 +167,9 @@ class LembagaFunctionality(BaseViewTest):
request = factory.post('/api/v1/lembaga/posts/', json_no_tema, format='json')
response = view(request)
self.assertEqual(response.status_code, 404)
request = factory.post('/api/v1/lembaga/posts/', json_no_lingkup_kerja, format='json')
response = view(request)
self.assertEqual(response.status_code, 404)
request = factory.post('/api/v1/lembaga/posts/', json_no_institusi, format='json')
response = view(request)
self.assertEqual(response.status_code, 404)
......@@ -148,6 +178,7 @@ class LembagaFunctionality(BaseViewTest):
"tema": {