Fakultas Ilmu Komputer UI

Commit 1966a7a6 authored by Muhammad Ariq Basyar's avatar Muhammad Ariq Basyar
Browse files

Merge branch 'development' into PBI-13-notifikasi

parents df5a470f dc14f8bc
# Generated by Django 3.1.7 on 2021-05-20 03:36
from django.db import migrations
import pplbackend.custom_model_field
class Migration(migrations.Migration):
dependencies = [
('informasi_fasilitas', '0016_kegiatan_links'),
]
operations = [
migrations.AlterField(
model_name='fotokegiatan',
name='foto',
field=pplbackend.custom_model_field.CompressedImageField(default=None, null=True, upload_to='kegiatan/'),
),
]
# Generated by Django 3.1.7 on 2021-05-20 04:51
from django.db import migrations
import pplbackend.custom_model_field
class Migration(migrations.Migration):
dependencies = [
('informasi_fasilitas', '0017_auto_20210520_0336'),
]
operations = [
migrations.AlterField(
model_name='fotokegiatan',
name='foto',
field=pplbackend.custom_model_field.CompressedImageField(default=None, null=True, quality=85, upload_to='kegiatan/'),
),
]
# Generated by Django 3.1.7 on 2021-05-27 22:51
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('informasi_fasilitas', '0018_auto_20210520_0451'),
]
operations = [
migrations.RemoveField(
model_name='kegiatan',
name='narahubung',
),
migrations.AddField(
model_name='kegiatan',
name='nama_kontak',
field=models.CharField(blank=True, max_length=50, null=True),
),
migrations.AddField(
model_name='kegiatan',
name='nomor_kontak',
field=models.CharField(default='111111111111111', max_length=15),
),
migrations.AddField(
model_name='kegiatan',
name='zona_waktu',
field=models.CharField(choices=[('WIB', 'Disabilitas Fisik'), ('WITA', 'Disabilitas Mental'), ('WIT', 'Disabilitas Intelektual')], default='WIB', max_length=4),
),
]
from django.db import models
from django.contrib.auth.models import User
from multiselectfield import MultiSelectField
from pplbackend.custom_model_field import CompressedImageField
from django.utils import timezone
import string
......@@ -45,6 +45,12 @@ JENIS_DISABILITAS = (
('DS', 'Disabilitas Sensorik'),
)
TIMEZONE_INDONESIA = (
('WIB', 'WIB'),
('WITA', 'WITA'),
('WIT', 'WIT'),
)
def _default_lokasi_place_id():
return \
''.join([random.choice(string.ascii_letters) for _ in range(40)])
......@@ -80,9 +86,11 @@ class Kegiatan(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE)
nama_kegiatan = models.CharField(max_length=50)
penyelenggara = models.CharField(max_length=50)
narahubung = models.TextField(null=True)
nama_kontak = models.CharField(max_length=50, null=True, blank=True)
nomor_kontak = models.CharField(max_length=15, unique=False, null=False, default="1"*15)
deskripsi = models.TextField(null=False)
links = models.TextField(null=True, blank=True)
zona_waktu = models.CharField(choices=TIMEZONE_INDONESIA, null=False, max_length=4, default="WIB")
time_start = models.DateTimeField(blank=False, null=False, default=timezone.now)
time_end = models.DateTimeField(blank=True, null=True)
......@@ -120,4 +128,4 @@ class KomentarKegiatan(Komentar):
class FotoKegiatan(models.Model):
objects = models.Manager()
kegiatan = models.ForeignKey(Kegiatan, related_name="images", on_delete=models.CASCADE)
foto = models.ImageField(upload_to="kegiatan/", null=True, default=None)
foto = CompressedImageField(upload_to="kegiatan/", null=True, default=None, quality=85)
from rest_framework import serializers
from .models import Lokasi, Kegiatan, KomentarKegiatan, FotoKegiatan
import pytz
TIMEZONE_INDONESIA = {
"WIB": pytz.timezone("Asia/Jakarta"),
"WITA": pytz.timezone("Asia/Makassar"),
"WIT": pytz.timezone("Asia/Jayapura"),
}
def time_converter(time, zona_waktu):
if zona_waktu in TIMEZONE_INDONESIA:
time = time.astimezone(TIMEZONE_INDONESIA[zona_waktu])
else:
time = time.astimezone("Asia/Jakarta")
return time
class LokasiSerializer(serializers.ModelSerializer):
......@@ -37,16 +52,37 @@ class KegiatanSerializer(serializers.ModelSerializer):
model = Kegiatan
fields = ('id', 'place_id', 'creator', 'lokasi', 'user',
'nama_kegiatan', 'penyelenggara', 'deskripsi',
"links","narahubung", 'time_start', 'time_end')
"links", "nomor_kontak", "nama_kontak",
"zona_waktu", 'time_start', 'time_end')
extra_kwargs = {
'nama_kegiatan': {'required': True},
'penyelenggara': {'required': True},
'deskripsi': {'required': True},
'narahubung': {"required": True},
'nomor_kontak': {"required": True},
'zona_waktu': {"required": True},
'time_start': {'required': True},
}
class KegiatanSerializerRead(KegiatanSerializer):
time_start = serializers.SerializerMethodField()
time_end = serializers.SerializerMethodField()
def get_time_start(self, obj):
time = obj.time_start
zona_waktu = obj.zona_waktu
time = time_converter(time, zona_waktu)
return time.strftime('%Y-%m-%d %H:%M')
def get_time_end(self, obj):
time = obj.time_end
zona_waktu = obj.zona_waktu
if time is None:
return None
time = time_converter(time, zona_waktu)
return time.strftime('%Y-%m-%d %H:%M')
class KomentarKegiatanSerializer(serializers.ModelSerializer):
kegiatan = serializers.IntegerField(source='informasi.id', read_only=True)
creator = serializers.CharField(source='user.last_name', read_only=True)
......
import json
import tempfile
import pytz
from datetime import datetime, timedelta
from django.test import TestCase, Client
from django.contrib.auth.models import User
from django.urls import reverse, path, include
from django.utils import timezone
from django.core.files.uploadedfile import SimpleUploadedFile
from django.core.files.base import ContentFile
......@@ -21,6 +22,11 @@ from .models import (
)
from pplbackend.utils import get_client_login_with_user
TIMEZONE_INDONESIA = {
"WIB": pytz.timezone("Asia/Jakarta"),
"WITA": pytz.timezone("Asia/Makassar"),
"WIT": pytz.timezone("Asia/Jayapura"),
}
class InformasiFasilitasTest(TestCase):
put_content_type = "application/x-www-form-urlencoded"
......@@ -48,15 +54,89 @@ class InformasiFasilitasTest(TestCase):
'deskripsi': 'sangat membantu',
}
# Waktu mungkin perlu disesuaikan lagi test dan implementasinya
time_start = timezone.now() + timedelta(days=1)
time_end = timezone.now() + timedelta(days=2)
time_start_zone = {
"WIB": time_start.astimezone(TIMEZONE_INDONESIA["WIB"]).strftime("%Y-%m-%d %H:%M%z"),
"WITA": time_start.astimezone(TIMEZONE_INDONESIA["WITA"]).strftime("%Y-%m-%d %H:%M%z"),
"WIT": time_start.astimezone(TIMEZONE_INDONESIA["WIT"]).strftime("%Y-%m-%d %H:%M%z"),
}
time_end_zone = {
"WIB": time_end.astimezone(TIMEZONE_INDONESIA["WIB"]).strftime("%Y-%m-%d %H:%M%z"),
"WITA": time_end.astimezone(TIMEZONE_INDONESIA["WITA"]).strftime("%Y-%m-%d %H:%M%z"),
"WIT": time_end.astimezone(TIMEZONE_INDONESIA["WIT"]).strftime("%Y-%m-%d %H:%M%z"),
}
# mock_kegiatan_test = {
# 'nama_kegiatan': 'mock kegiatan',
# 'penyelenggara': 'mock penyelenggara',
# 'time_start':(datetime.now()+timedelta(days=1)).strftime("%Y-%m-%d %H:%M"),
# 'time_end': (datetime.now()+timedelta(days=2)).strftime("%Y-%m-%d %H:%M"),
# 'narahubung': 'sebuah narahubung',
# 'deskripsi': 'sebuah deskripsi',
# 'links': "www.example.com;www.example.com"
# }
mock_kegiatan_test = {
'nama_kegiatan': 'mock kegiatan',
'penyelenggara': 'mock penyelenggara',
'time_start':(datetime.now()+timedelta(days=1)).strftime("%Y-%m-%d %H:%M"),
'time_end': (datetime.now()+timedelta(days=2)).strftime("%Y-%m-%d %H:%M"),
'narahubung': 'sebuah narahubung',
"zona_waktu": "WIB",
'time_start': time_start_zone["WIB"],
'time_end': time_end_zone["WIB"],
'nama_kontak': 'sebuah narahubung',
'nomor_kontak': "1" * 15,
'deskripsi': 'sebuah deskripsi',
'links': "www.example.com"
}
mock_kegiatan_wita_test = {
'nama_kegiatan': 'mock kegiatan',
'penyelenggara': 'mock penyelenggara',
"zona_waktu": "WITA",
'time_start': time_start_zone["WITA"],
'time_end': time_end_zone["WITA"],
'nama_kontak': 'sebuah narahubung',
'nomor_kontak': "1" * 15,
'deskripsi': 'sebuah deskripsi',
'links': "www.example.com"
}
mock_kegiatan_wit_test = {
'nama_kegiatan': 'mock kegiatan',
'penyelenggara': 'mock penyelenggara',
"zona_waktu": "WIT",
'time_start': time_start_zone["WIT"],
'time_end': time_end_zone["WIT"],
'nama_kontak': 'sebuah narahubung',
'nomor_kontak': "1" * 15,
'deskripsi': 'sebuah deskripsi',
'links': "www.example.com"
}
mock_kegiatan_time_order_test = {
'nama_kegiatan': 'mock kegiatan',
'penyelenggara': 'mock penyelenggara',
"zona_waktu": "WIB",
'time_start': time_start_zone["WIB"],
'time_end': time_end_zone["WIB"],
'nama_kontak': 'sebuah narahubung',
'nomor_kontak': "1" * 15,
'deskripsi': 'sebuah deskripsi',
'links': "www.example.com"
}
mock_kegiatan_name_order_test = {
'nama_kegiatan': 'aaaa mock kegiatan',
'penyelenggara': 'mock penyelenggara',
"zona_waktu": "WIB",
'time_start': time_start_zone["WIB"],
'time_end': time_end_zone["WIB"],
'nama_kontak': 'sebuah narahubung',
'nomor_kontak': "1" * 15,
'deskripsi': 'sebuah deskripsi',
'links': "www.example.com;www.example.com"
'links': "www.example.com"
}
mock_komentar_kegiatan_test = {
......
......@@ -14,12 +14,14 @@ from .test_base import InformasiFasilitasViewTest
from .models import Lokasi, Kegiatan, FotoKegiatan
from pplbackend.utils import response_decode
class KegiatanRelatedViewTest(InformasiFasilitasViewTest):
class KegiatanRelatedViewTest(InformasiFasilitasViewTest):
def setUp(self):
super().setUp()
self.media_root = os.path.join(settings.BASE_DIR, 'test_file/media')
self.kegiatan = self.create_kegiatan_test(self.user, self.lokasi)
self.kegiatan_time_start = self.kegiatan.time_start[:16]
self.kegiatan_time_end = self.kegiatan.time_end[:16]
self.kwargs_place_id = {'place_id': self.lokasi.place_id}
self.kwargs_add_or_update_kegiatan = {
'place_id': self.lokasi.place_id,
......@@ -29,10 +31,18 @@ class KegiatanRelatedViewTest(InformasiFasilitasViewTest):
'place_id': self.lokasi.place_id,
'kegiatan_id': self.kegiatan.id,
}
self.kwargs_search_kegiatan = {'query': 'mock',}
self.kwargs_search_kegiatan_fail = {'query': 'this shouldnt exist',}
self.kwargs_search_kegiatan = {'query': 'mock', }
self.kwargs_search_kegiatan_fail = {'query': 'this shouldnt exist', }
self.kwargs_kegiatan_id = {'kegiatan_id' : self.kegiatan.lokasi.place_id}
self.kwargs_kegiatan_id = {'kegiatan_id': self.kegiatan.lokasi.place_id}
self.kwargs_list_kegiatan_in_order = {
'start_index': 0,
'query_limit': 10,
}
self.kwargs_list_kegiatan_in_order_fail = {
'start_index': 10,
'query_limit': 20,
}
image_path1, image_path2 = ("test_file/test1.jpg", "test_file/test2.jpg")
image1 = SimpleUploadedFile("test1.jpg", content=open(image_path1, 'rb').read(),
......@@ -43,6 +53,7 @@ class KegiatanRelatedViewTest(InformasiFasilitasViewTest):
self.kegiatan_images = {'images': [image1, image2]}
for image in self.kegiatan_images["images"]:
FotoKegiatan.objects.create(kegiatan=self.kegiatan, foto=image)
image.seek(0)
self.get_list_kegiatan_url = \
reverse('list-kegiatan', kwargs=self.kwargs_place_id)
......@@ -53,13 +64,25 @@ class KegiatanRelatedViewTest(InformasiFasilitasViewTest):
self.add_kegiatan_url = \
reverse('add-kegiatan', kwargs=self.kwargs_place_id)
self.update_kegiatan_url = reverse('update-kegiatan',
kwargs=self.kwargs_add_or_update_kegiatan)
kwargs=self.kwargs_add_or_update_kegiatan)
self.search_kegiatan_url = reverse('search-kegiatan',
kwargs=self.kwargs_search_kegiatan)
kwargs=self.kwargs_search_kegiatan)
self.search_kegiatan_fail_url = reverse('search-kegiatan',
kwargs=self.kwargs_search_kegiatan_fail)
kwargs=self.kwargs_search_kegiatan_fail)
self.list_foto_kegiatan_url = \
reverse('list-foto-kegiatan', kwargs=self.kwargs_get_foto_kegiatan)
self.list_kegiatan_by_latest_added_url = \
reverse('list-kegiatan-by-latest-added', kwargs=self.kwargs_list_kegiatan_in_order)
self.list_kegiatan_by_name_url = \
reverse('list-kegiatan-by-name', kwargs=self.kwargs_list_kegiatan_in_order)
self.list_kegiatan_by_time_url = \
reverse('list-kegiatan-by-time', kwargs=self.kwargs_list_kegiatan_in_order)
self.list_kegiatan_by_latest_added_fail_url = \
reverse('list-kegiatan-by-latest-added', kwargs=self.kwargs_list_kegiatan_in_order_fail)
self.list_kegiatan_by_name_fail_url = \
reverse('list-kegiatan-by-name', kwargs=self.kwargs_list_kegiatan_in_order_fail)
self.list_kegiatan_by_time_fail_url = \
reverse('list-kegiatan-by-time', kwargs=self.kwargs_list_kegiatan_in_order_fail)
def tearDown(self):
try:
......@@ -67,7 +90,6 @@ class KegiatanRelatedViewTest(InformasiFasilitasViewTest):
except OSError:
pass
@override_settings(MEDIA_ROOT=("test_file" + '/media'))
def test_can_add_kegiatan(self):
Kegiatan.objects.all().delete()
......@@ -79,8 +101,9 @@ class KegiatanRelatedViewTest(InformasiFasilitasViewTest):
data.pop("id", None)
expected_json = self.mock_kegiatan_test.copy()
expected_json.update({'creator': 'mock last_name',
'place_id': 'mock_place_id'
})
'place_id': 'mock_place_id',
'time_start': self.kegiatan_time_start,
'time_end': self.kegiatan_time_end})
self.assertEqual(response.status_code, HTTPStatus.CREATED)
self.assertDictEqual(data, expected_json)
count = Kegiatan.objects.all().count()
......@@ -114,13 +137,15 @@ class KegiatanRelatedViewTest(InformasiFasilitasViewTest):
'id': self.kegiatan.id,
'place_id': self.kegiatan.lokasi.place_id,
'creator': self.kegiatan.user.last_name,
'nama_kegiatan' : self.kegiatan.nama_kegiatan,
'nama_kegiatan': self.kegiatan.nama_kegiatan,
'penyelenggara': self.kegiatan.penyelenggara,
'deskripsi': self.kegiatan.deskripsi,
'links': self.kegiatan.links,
'narahubung': self.kegiatan.narahubung,
'time_start': self.kegiatan.time_start,
'time_end': self.kegiatan.time_end,
'nama_kontak': self.kegiatan.nama_kontak,
'nomor_kontak': self.kegiatan.nomor_kontak,
'zona_waktu': self.kegiatan.zona_waktu,
'time_start': self.kegiatan_time_start,
'time_end': self.kegiatan_time_end,
},
}
self.assertEqual(content, expected_json)
......@@ -130,34 +155,94 @@ class KegiatanRelatedViewTest(InformasiFasilitasViewTest):
self.assertEqual(response.status_code, HTTPStatus.OK)
content = json.loads(response.content.decode('utf-8'))
expected_json = {
'id': self.kegiatan.id,
'place_id': self.kegiatan.lokasi.place_id,
'creator': self.kegiatan.user.last_name,
'nama_kegiatan' : self.kegiatan.nama_kegiatan,
'penyelenggara': self.kegiatan.penyelenggara,
'deskripsi': self.kegiatan.deskripsi,
'links': self.kegiatan.links,
'narahubung': self.kegiatan.narahubung,
'time_start': self.kegiatan.time_start,
'time_end': self.kegiatan.time_end,
'id': self.kegiatan.id,
'place_id': self.kegiatan.lokasi.place_id,
'creator': self.kegiatan.user.last_name,
'nama_kegiatan': self.kegiatan.nama_kegiatan,
'penyelenggara': self.kegiatan.penyelenggara,
'deskripsi': self.kegiatan.deskripsi,
'links': self.kegiatan.links,
'nama_kontak': self.kegiatan.nama_kontak,
'nomor_kontak': self.kegiatan.nomor_kontak,
'zona_waktu': self.kegiatan.zona_waktu,
'time_start': self.kegiatan_time_start,
'time_end': self.kegiatan_time_end,
}
self.assertEqual(content, expected_json)
def test_can_get_detail_kegiatan_wita(self):
Kegiatan.objects.all().delete()
kegiatan_wita = self.create_kegiatan_test(kegiatan_dict=self.mock_kegiatan_wita_test,
user=self.user, lokasi=self.lokasi)
get_detail_kegiatan_url = \
reverse('detail-kegiatan', kwargs={
'place_id': kegiatan_wita.lokasi.place_id,
'id': kegiatan_wita.id,
})
response = Client().get(get_detail_kegiatan_url)
self.assertEqual(response.status_code, HTTPStatus.OK)
content = json.loads(response.content.decode('utf-8'))
expected_json = {
'id': kegiatan_wita.id,
'place_id': kegiatan_wita.lokasi.place_id,
'creator': kegiatan_wita.user.last_name,
'nama_kegiatan': kegiatan_wita.nama_kegiatan,
'penyelenggara': kegiatan_wita.penyelenggara,
'deskripsi': kegiatan_wita.deskripsi,
'links': kegiatan_wita.links,
'nama_kontak': kegiatan_wita.nama_kontak,
'nomor_kontak': kegiatan_wita.nomor_kontak,
'zona_waktu': kegiatan_wita.zona_waktu,
'time_start': kegiatan_wita.time_start[:16],
'time_end': kegiatan_wita.time_end[:16],
}
self.assertDictEqual(content, expected_json)
def test_can_get_detail_kegiatan_wit(self):
Kegiatan.objects.all().delete()
kegiatan_wit = self.create_kegiatan_test(kegiatan_dict=self.mock_kegiatan_wit_test,
user=self.user, lokasi=self.lokasi)
get_detail_kegiatan_url = \
reverse('detail-kegiatan', kwargs={
'place_id': kegiatan_wit.lokasi.place_id,
'id': kegiatan_wit.id,
})
response = Client().get(get_detail_kegiatan_url)
self.assertEqual(response.status_code, HTTPStatus.OK)
content = json.loads(response.content.decode('utf-8'))
expected_json = {
'id': kegiatan_wit.id,
'place_id': kegiatan_wit.lokasi.place_id,
'creator': kegiatan_wit.user.last_name,
'nama_kegiatan': kegiatan_wit.nama_kegiatan,
'penyelenggara': kegiatan_wit.penyelenggara,
'deskripsi': kegiatan_wit.deskripsi,
'links': kegiatan_wit.links,
'nama_kontak': kegiatan_wit.nama_kontak,
'nomor_kontak': kegiatan_wit.nomor_kontak,
'zona_waktu': kegiatan_wit.zona_waktu,
'time_start': kegiatan_wit.time_start[:16],
'time_end': kegiatan_wit.time_end[:16],
}
self.assertDictEqual(content, expected_json)
def test_can_get_nearest_kegiatan(self):
response = Client().get(self.get_nearest_kegiatan_url)
self.assertEqual(response.status_code, HTTPStatus.OK)
content = json.loads(response.content.decode('utf-8'))
expected_json = {
'id': self.kegiatan.id,
'place_id': self.kegiatan.lokasi.place_id,
'creator': self.kegiatan.user.last_name,
'nama_kegiatan' : self.kegiatan.nama_kegiatan,
'penyelenggara': self.kegiatan.penyelenggara,
'deskripsi': self.kegiatan.deskripsi,
'links': self.kegiatan.links,
'narahubung': self.kegiatan.narahubung,
'time_start': self.kegiatan.time_start,
'time_end': self.kegiatan.time_end,
'id': self.kegiatan.id,
'place_id': self.kegiatan.lokasi.place_id,
'creator': self.kegiatan.user.last_name,
'nama_kegiatan': self.kegiatan.nama_kegiatan,
'penyelenggara': self.kegiatan.penyelenggara,
'deskripsi': self.kegiatan.deskripsi,
'links': self.kegiatan.links,
'nama_kontak': self.kegiatan.nama_kontak,
'nomor_kontak': self.kegiatan.nomor_kontak,
'zona_waktu': self.kegiatan.zona_waktu,
'time_start': self.kegiatan_time_start,
'time_end': self.kegiatan_time_end,
}
self.assertEqual(content, expected_json)
......@@ -179,8 +264,10 @@ class KegiatanRelatedViewTest(InformasiFasilitasViewTest):
data.pop("id", None)
expected_json = self.mock_kegiatan_test.copy()
expected_json.update({'creator': 'mock last_name',
'place_id': 'mock_place_id'
})
'place_id': 'mock_place_id',
'time_start': self.kegiatan_time_start,
'time_end': self.kegiatan_time_end})
send_data.pop("images")
expected_json.update(send_data)
self.assertEqual(response.status_code, HTTPStatus.ACCEPTED)
......@@ -191,7 +278,6 @@ class KegiatanRelatedViewTest(InformasiFasilitasViewTest):
self.assertEqual(count, 1)
self.assertEqual(count_foto, 4)
def test_update_kegiatan_lokasi_not_exist(self):
Kegiatan.objects.all().delete()
url = reverse('update-kegiatan', kwargs={
......@@ -206,17 +292,16 @@ class KegiatanRelatedViewTest(InformasiFasilitasViewTest):
response = self.client.put(url, data=send_data)
self.assertEqual(response.status_code, HTTPStatus.NOT_FOUND)
def test_can_get_list_foto_kegiatan(self):
response = Client().get(self.list_foto_kegiatan_url)
data = response.json()
self.assertEqual(len(data), 2)
counter = 1
for _, item in data.items():
self.assertIn("test"+str(counter), item["foto"])
self.assertIn("test" + str(counter), item["foto"])
self.assertEqual(item["kegiatan"], self.kegiatan.id)
counter += 1
def test_can_search_kegiatan(self):
response = Client().get(self.search_kegiatan_url)
self.assertEqual(response.status_code, HTTPStatus.OK)
......@@ -226,17 +311,104 @@ class KegiatanRelatedViewTest(InformasiFasilitasViewTest):
'id': self.kegiatan.id,
'place_id': self.kegiatan.lokasi.place_id,
'creator': self.kegiatan.user.last_name,
'nama_kegiatan' : self.kegiatan.nama_kegiatan,
'nama_kegiatan': self.kegiatan.nama_kegiatan,
'penyelenggara': self.kegiatan.penyelenggara,
'deskripsi': self.kegiatan.deskripsi,
'links': self.kegiatan.links,
'narahubung': self.kegiatan.narahubung,
'time_start': self.kegiatan.time_start,
'time_end': self.kegiatan.time_end,
'nama_kontak': self.kegiatan.nama_kontak,
'nomor_kontak': self.kegiatan.nomor_kontak,
'zona_waktu': self.kegiatan.zona_waktu,
'time_start': self.kegiatan_time_start,
'time_end': self.kegiatan_time_end,
},
}
self.assertEqual(content, expected_json)
def test_search_kegiatan_empty_result_or_fail(self):
response = Client().get(self.search_kegiatan_fail_url)
self.assertEqual(response.status_code, HTTPStatus.NOT_FOUND)