Fakultas Ilmu Komputer UI

Commit c54ba8bb authored by Muhammad Ariq Basyar's avatar Muhammad Ariq Basyar
Browse files

Merge branch 'PBI-13-notifikasi' into 'development'

PBI 13 notifikasi

See merge request !60
parents dc14f8bc 08026b73
Pipeline #80394 passed with stages
in 9 minutes and 39 seconds
......@@ -2,11 +2,11 @@ from django.contrib import admin, messages
from django.utils.translation import gettext_lazy as _
from notification.utils import send_komentar_notification, get_target_fcm_device
from .models import Lokasi, Fasilitas, Komentar, Kegiatan, KomentarKegiatan, FotoKegiatan
from .models import Lokasi, Fasilitas, KomentarFasilitas, Kegiatan, KomentarKegiatan, FotoKegiatan
class KomentarAdmin(admin.ModelAdmin):
list_display = ('__str__', 'deskripsi', 'user', 'notify_to')
list_display = ('__str__', 'user', 'created', 'notify_to')
actions = ('send_notification',)
def send_notification(self, request, queryset):
......@@ -30,7 +30,7 @@ class KomentarAdmin(admin.ModelAdmin):
# Register your models here.
admin.site.register(Lokasi)
admin.site.register(Fasilitas)
admin.site.register(Komentar, KomentarAdmin)
admin.site.register(KomentarFasilitas, KomentarAdmin)
admin.site.register(Kegiatan)
admin.site.register(KomentarKegiatan, KomentarAdmin)
admin.site.register(FotoKegiatan)
# Generated by Django 3.1.7 on 2021-05-31 10:03
from django.conf import settings
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('informasi_fasilitas', '0016_kegiatan_links'),
]
operations = [
migrations.RenameModel(
old_name='Komentar',
new_name='KomentarFasilitas',
),
migrations.RenameField(
model_name='komentarfasilitas',
old_name='date_time',
new_name='created',
),
]
# Generated by Django 3.1.7 on 2021-05-31 12:02
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('informasi_fasilitas', '0017_auto_20210531_1003'),
]
operations = [
migrations.RenameField(
model_name='komentarfasilitas',
old_name='fasilitas',
new_name='informasi',
),
migrations.RenameField(
model_name='komentarkegiatan',
old_name='kegiatan',
new_name='informasi',
),
]
# Generated by Django 3.1.7 on 2021-05-31 12:41
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('informasi_fasilitas', '0018_auto_20210531_1202'),
('informasi_fasilitas', '0019_auto_20210527_2251'),
]
operations = [
]
......@@ -97,14 +97,19 @@ class Kegiatan(models.Model):
class Komentar(models.Model):
objects = models.Manager()
fasilitas = models.ForeignKey(Fasilitas, on_delete=models.CASCADE)
user = models.ForeignKey(User, on_delete=models.CASCADE)
date_time = models.DateTimeField(auto_now_add=True)
deskripsi = models.TextField()
created = models.DateTimeField(auto_now_add=True)
class Meta:
abstract = True
def __str__(self):
return self.deskripsi
class KomentarFasilitas(Komentar):
informasi = models.ForeignKey(Fasilitas, on_delete=models.CASCADE)
class Likes(models.Model):
objects = models.Manager()
user = models.ForeignKey(User, on_delete=models.CASCADE)
......@@ -117,15 +122,8 @@ class Dislikes(models.Model):
fasilitas = models.ForeignKey(Fasilitas, on_delete=models.CASCADE)
created = models.DateTimeField(auto_now_add=True)
class KomentarKegiatan(models.Model):
objects = models.Manager()
user = models.ForeignKey(User, on_delete=models.CASCADE)
kegiatan = models.ForeignKey(Kegiatan, on_delete=models.CASCADE)
deskripsi = models.TextField()
created = models.DateTimeField(auto_now_add=True)
def __str__(self):
return self.deskripsi
class KomentarKegiatan(Komentar):
informasi = models.ForeignKey(Kegiatan, on_delete=models.CASCADE)
class FotoKegiatan(models.Model):
objects = models.Manager()
......
......@@ -84,7 +84,7 @@ class KegiatanSerializerRead(KegiatanSerializer):
return time.strftime('%Y-%m-%d %H:%M')
class KomentarKegiatanSerializer(serializers.ModelSerializer):
kegiatan = serializers.IntegerField(source='kegiatan.id', read_only=True)
kegiatan = serializers.IntegerField(source='informasi.id', read_only=True)
creator = serializers.CharField(source='user.last_name', read_only=True)
class Meta:
model = KomentarKegiatan
......
......@@ -37,7 +37,7 @@ class TestAdmin(TestCase):
def test_list_display(self):
list_display = self.komentar_admin.get_list_display(request)
self.assertEqual(list_display, ('__str__', 'deskripsi', 'user',
self.assertEqual(list_display, ('__str__', 'user', 'created',
'notify_to'))
def test_list_actions(self):
......
......@@ -12,7 +12,7 @@ from django.core.files.base import ContentFile
from .models import (
Lokasi,
Fasilitas,
Komentar,
KomentarFasilitas,
KURSI_RODA,
Likes,
Dislikes,
......@@ -257,10 +257,10 @@ class InformasiFasilitasTest(TestCase):
fasilitas_dict=fasilitas_dict,
)
return Komentar.objects.create(
return KomentarFasilitas.objects.create(
**komentar_dict,
user=user,
fasilitas=fasilitas,
informasi=fasilitas,
)
def create_likes_test(
......@@ -364,19 +364,19 @@ class InformasiFasilitasTest(TestCase):
user=None,
komentar_kegiatan_dict=mock_komentar_kegiatan_test,
user_dict=mock_user_test,
kegiatan=None
informasi=None
):
user = self.get_or_create_user_test(
user=user,
user_dict=user_dict,
)
if kegiatan is None:
kegiatan = self.create_kegiatan_test()
if informasi is None:
informasi = self.create_kegiatan_test()
return KomentarKegiatan.objects.create(
**komentar_kegiatan_dict,
kegiatan=kegiatan,
informasi=informasi,
user=user
)
......
from django.db.utils import IntegrityError
from .test_base import InformasiFasilitasTest
from .models import (Lokasi, Fasilitas, Komentar, Likes, Dislikes,
from .models import (Lokasi, Fasilitas, KomentarFasilitas, Likes, Dislikes,
Kegiatan, FotoKegiatan, KomentarKegiatan)
......@@ -49,13 +49,13 @@ class InformasiFasilitasModelTest(InformasiFasilitasTest):
def test_models_komentar_not_created(self):
with self.assertRaises(IntegrityError) as ex:
obj = Komentar(fasilitas=None)
obj = KomentarFasilitas(informasi=None)
obj.save()
self.assertEqual(ex.expected, IntegrityError)
def test_models_create_new_komentar(self):
self.create_komentar_test()
count = Komentar.objects.all().count()
count = KomentarFasilitas.objects.all().count()
self.assertNotEqual(count, 0)
def test_models_komentar_str(self):
......
......@@ -3,7 +3,7 @@ from http import HTTPStatus
from django.urls import reverse
from .test_base import InformasiFasilitasViewTest
from .models import Komentar
from .models import KomentarFasilitas
from pplbackend.utils import response_decode
from .views import TIME_FORMAT
......@@ -26,7 +26,7 @@ class KomentarRelatedViewTest(InformasiFasilitasViewTest):
self.client.post(self.add_komentar_url, self.mock_komentar_test)
self.assertEqual(response.status_code, HTTPStatus.CREATED)
count = Komentar.objects.filter(fasilitas=self.fasilitas).count()
count = KomentarFasilitas.objects.filter(informasi=self.fasilitas).count()
self.assertEqual(count, 1)
def test_cannot_comment_facility_if_deskripsi_empty(self):
......@@ -48,7 +48,7 @@ class KomentarRelatedViewTest(InformasiFasilitasViewTest):
'id': komentar.id,
'deskripsi': komentar.deskripsi,
'creator': komentar.user.last_name,
'date_time': komentar.date_time.strftime(TIME_FORMAT),
'created': komentar.created.strftime(TIME_FORMAT),
}
}
self.assertEqual(response_json, expected_json)
......@@ -29,7 +29,7 @@ class KomentarKegiatanRelatedViewTest(InformasiFasilitasViewTest):
self.client.post(self.add_komentar_kegiatan_url, self.mock_komentar_kegiatan_test)
self.assertEqual(response.status_code, HTTPStatus.CREATED)
count = KomentarKegiatan.objects.filter(kegiatan=self.kegiatan).count()
count = KomentarKegiatan.objects.filter(informasi=self.kegiatan).count()
self.assertEqual(count, 1)
def test_fail_add_komentar_kegiatan(self):
......@@ -38,18 +38,18 @@ class KomentarKegiatanRelatedViewTest(InformasiFasilitasViewTest):
self.client.post(self.add_komentar_kegiatan_url, None)
self.assertEqual(response.status_code, HTTPStatus.NOT_FOUND)
count = KomentarKegiatan.objects.filter(kegiatan=self.kegiatan).count()
count = KomentarKegiatan.objects.filter(informasi=self.kegiatan).count()
self.assertEqual(count, 0)
def test_can_get_list_komentar_kegiatan(self):
komentar = self.create_komentar_kegiatan_test(user=self.user, kegiatan=self.kegiatan)
komentar = self.create_komentar_kegiatan_test(user=self.user, informasi=self.kegiatan)
response = self.client.get(self.list_komentar_kegiatan_url)
self.assertEqual(response.status_code, HTTPStatus.OK)
response_json = response_decode(response)
expected_id = komentar.id
expected_creator = komentar.user.last_name
expected_kegiatan = komentar.kegiatan.id
expected_kegiatan = komentar.informasi.id
expected_deskripsi = komentar.deskripsi
self.assertEqual(response_json[str(komentar.id)]['id'], expected_id)
......@@ -59,7 +59,7 @@ class KomentarKegiatanRelatedViewTest(InformasiFasilitasViewTest):
self.assertEqual(True, ('created' in response_json[str(komentar.id)].keys()))
def test_can_get_komentar_kegiatan(self):
komentar = self.create_komentar_kegiatan_test(user=self.user, kegiatan=self.kegiatan)
komentar = self.create_komentar_kegiatan_test(user=self.user, informasi=self.kegiatan)
kwargs_get_komentar_kegiatan = {
'place_id': self.lokasi.place_id,
'kegiatan_id': self.kegiatan.id,
......@@ -73,7 +73,7 @@ class KomentarKegiatanRelatedViewTest(InformasiFasilitasViewTest):
response_json = response_decode(response)
expected_id = komentar.id
expected_creator = komentar.user.last_name
expected_kegiatan = komentar.kegiatan.id
expected_kegiatan = komentar.informasi.id
expected_deskripsi = komentar.deskripsi
self.assertEqual(response_json['id'], expected_id)
......@@ -88,7 +88,7 @@ class KomentarKegiatanRelatedViewTest(InformasiFasilitasViewTest):
def test_can_delete_komentar_kegiatan(self):
KomentarKegiatan.objects.all().delete()
komentar = self.create_komentar_kegiatan_test(user=self.user, kegiatan=self.kegiatan)
komentar = self.create_komentar_kegiatan_test(user=self.user, informasi=self.kegiatan)
kwargs_delete_komentar_kegiatan = {
'place_id': self.lokasi.place_id,
......@@ -102,7 +102,7 @@ class KomentarKegiatanRelatedViewTest(InformasiFasilitasViewTest):
response = self.client.delete(delete_komentar_kegiatan_url)
self.assertEqual(response.status_code, HTTPStatus.OK)
count = KomentarKegiatan.objects.filter(kegiatan=self.kegiatan).count()
count = KomentarKegiatan.objects.filter(informasi=self.kegiatan).count()
self.assertEqual(count, 0)
def test_fail_delete_komentar_kegiatan(self):
......
......@@ -9,7 +9,7 @@ from rest_framework import viewsets
from notification.utils import send_komentar_notification
from .serializers import LokasiSerializer
from .models import Lokasi, Fasilitas, Komentar, Likes, Dislikes
from .models import Lokasi, Fasilitas, KomentarFasilitas, Likes, Dislikes
from .permissions import UserPermission
TIME_FORMAT = "%d-%m-%Y %H:%M:%S"
......@@ -242,13 +242,13 @@ def add_komentar(request, place_id, id):
lokasi = Lokasi.objects.get(place_id=place_id)
fasilitas = Fasilitas.objects.get(lokasi=lokasi, id=id)
deskripsi = request.POST['deskripsi']
komentar = Komentar.objects.create(fasilitas=fasilitas,
komentar = KomentarFasilitas.objects.create(informasi=fasilitas,
user=request.user,
deskripsi=deskripsi)
send_komentar_notification(komentar)
return JsonResponse({'response': 'komentar added',
'id': komentar.id,
"created_date": komentar.date_time.strftime(TIME_FORMAT)}, status=HTTPStatus.CREATED)
"created_date": komentar.created.strftime(TIME_FORMAT)}, status=HTTPStatus.CREATED)
except KeyError as e:
return JsonResponse({'response': missing_key_message(str(e))}, status=HTTPStatus.BAD_REQUEST)
except Exception as e:
......@@ -262,7 +262,7 @@ def list_komentar(request, place_id, id):
try:
lokasi = Lokasi.objects.get(place_id=place_id)
fasilitas = Fasilitas.objects.get(lokasi=lokasi, id=id)
list_komentar = Komentar.objects.filter(fasilitas=fasilitas)
list_komentar = KomentarFasilitas.objects.filter(informasi=fasilitas)
return_json = {}
for komentar in list_komentar:
return_json[komentar.id] = {}
......@@ -270,7 +270,7 @@ def list_komentar(request, place_id, id):
komentar_details["id"] = komentar.id
komentar_details["deskripsi"] = komentar.deskripsi
komentar_details["creator"] = komentar.user.last_name
komentar_details["date_time"] = komentar.date_time.strftime(
komentar_details["created"] = komentar.created.strftime(
TIME_FORMAT)
return JsonResponse(return_json, status=HTTPStatus.OK)
except KeyError as key:
......
......@@ -15,7 +15,7 @@ from .models import Kegiatan, KomentarKegiatan
@permission_classes([])
def list_komentar_kegiatan(request, place_id, kegiatan_id):
try:
queryset = KomentarKegiatan.objects.filter(kegiatan__lokasi__place_id=place_id, kegiatan__id=kegiatan_id)
queryset = KomentarKegiatan.objects.filter(informasi__lokasi__place_id=place_id, informasi__id=kegiatan_id)
serializer = KomentarKegiatanSerializer(queryset, many=True)
data_response = serializer.data
new_dict = {item['id']: dict(item) for item in data_response}
......@@ -28,8 +28,8 @@ def list_komentar_kegiatan(request, place_id, kegiatan_id):
@permission_classes([])
def get_komentar_kegiatan(request, place_id, kegiatan_id, komentar_id):
try:
komentar = KomentarKegiatan.objects.get(kegiatan__lokasi__place_id=place_id,
kegiatan__id=kegiatan_id, id=komentar_id)
komentar = KomentarKegiatan.objects.get(informasi__lokasi__place_id=place_id,
informasi__id=kegiatan_id, id=komentar_id)
serializer = KomentarKegiatanSerializer(komentar, many=False)
return JsonResponse(serializer.data, status=HTTPStatus.OK)
except ObjectDoesNotExist:
......@@ -44,7 +44,7 @@ def add_komentar_kegiatan(request, place_id, kegiatan_id):
deskripsi = request.POST['deskripsi']
komentar = KomentarKegiatan.objects \
.create(
kegiatan=kegiatan,
informasi=kegiatan,
user=request.user,
deskripsi=deskripsi
)
......@@ -59,7 +59,7 @@ def add_komentar_kegiatan(request, place_id, kegiatan_id):
@permission_classes([IsAuthenticated])
def delete_komentar_kegiatan(request, place_id, kegiatan_id, komentar_id):
try:
komentar = KomentarKegiatan.objects.get(kegiatan__lokasi__place_id=place_id, kegiatan__id=kegiatan_id, id=komentar_id)
komentar = KomentarKegiatan.objects.get(informasi__lokasi__place_id=place_id, informasi__id=kegiatan_id, id=komentar_id)
komentar.delete()
return JsonResponse({'response': 'komentar kegiatan deleted', 'id': komentar_id},
status=HTTPStatus.OK)
......
......@@ -4,7 +4,7 @@ from django.db.models import QuerySet
from django.contrib.auth.models import User
from fcm_django.models import FCMDevice
from informasi_fasilitas.models import (Komentar, KomentarKegiatan,
from informasi_fasilitas.models import (KomentarFasilitas, KomentarKegiatan,
Fasilitas, Kegiatan, Lokasi)
from . import utils
from .test_base import BaseTestNotification
......@@ -12,7 +12,7 @@ from .test_base import BaseTestNotification
class TestUtilsNotification(BaseTestNotification):
def test_get_type_informasi_from_komentar_should_return_fasilitas(self):
komentar = Komentar()
komentar = KomentarFasilitas()
type_fasilitas = utils.get_type_informasi_from_komentar(komentar)
self.assertEqual(type_fasilitas, 'fasilitas')
......@@ -23,13 +23,13 @@ class TestUtilsNotification(BaseTestNotification):
def test_get_informasi_from_komentar_should_return_fasilitas(self):
fasilitas = Fasilitas()
komentar = Komentar(fasilitas=fasilitas)
komentar = KomentarFasilitas(informasi=fasilitas)
ret_fasilitas = utils.get_informasi(komentar)
self.assertTrue(isinstance(ret_fasilitas, Fasilitas))
def test_get_informasi_from_komentarkegiatan_should_return_kegiatan(self):
kegiatan = Kegiatan()
komentar_kegiatan = KomentarKegiatan(kegiatan=kegiatan)
komentar_kegiatan = KomentarKegiatan(informasi=kegiatan)
ret_kegiatan = utils.get_informasi(komentar_kegiatan)
self.assertTrue(isinstance(ret_kegiatan, Kegiatan))
......@@ -37,7 +37,7 @@ class TestUtilsNotification(BaseTestNotification):
place_id = 'dummy_place_id'
lokasi = Lokasi(place_id=place_id)
fasilitas = Fasilitas(lokasi=lokasi)
komentar = Komentar(fasilitas=fasilitas)
komentar = KomentarFasilitas(informasi=fasilitas)
ret_place_id = utils.get_place_id_from_komentar(komentar)
......@@ -47,7 +47,7 @@ class TestUtilsNotification(BaseTestNotification):
place_id = 'dummy_place_id'
lokasi = Lokasi(place_id=place_id)
kegiatan = Kegiatan(lokasi=lokasi)
komentar = KomentarKegiatan(kegiatan=kegiatan)
komentar = KomentarKegiatan(informasi=kegiatan)
ret_place_id = utils.get_place_id_from_komentar(komentar)
......@@ -56,7 +56,7 @@ class TestUtilsNotification(BaseTestNotification):
def test_get_informasi_id_from_komentar_should_return_its_informasi_id(self):
_id = 8
fasilitas = Fasilitas(id=_id)
komentar = Komentar(fasilitas=fasilitas)
komentar = KomentarFasilitas(informasi=fasilitas)
ret_place_id = utils.get_informasi_id_from_komentar(komentar)
......@@ -65,7 +65,7 @@ class TestUtilsNotification(BaseTestNotification):
def test_get_informasi_id_from_komentar_kegiatan_should_return_its_informasi_id(self):
_id = 9
kegiatan = Kegiatan(id=_id)
komentar = KomentarKegiatan(kegiatan=kegiatan)
komentar = KomentarKegiatan(informasi=kegiatan)
ret_place_id = utils.get_informasi_id_from_komentar(komentar)
......@@ -73,7 +73,7 @@ class TestUtilsNotification(BaseTestNotification):
def test_get_sender_last_name_from_komentar_not_null(self):
user = User(last_name='ariqbasyar')
komentar = Komentar(user=user)
komentar = KomentarFasilitas(user=user)
ret_last_name = utils.get_sender_last_name_from_komentar(komentar)
......@@ -89,7 +89,7 @@ class TestUtilsNotification(BaseTestNotification):
fcmdevice.save()
fasilitas = Fasilitas(user=user)
komentar = Komentar(fasilitas=fasilitas, user=user_sender)
komentar = KomentarFasilitas(informasi=fasilitas, user=user_sender)
ret_fcm_device = utils.get_target_fcm_device(komentar)
......@@ -110,7 +110,7 @@ class TestUtilsNotification(BaseTestNotification):
fcmdevice.save()
fasilitas = Fasilitas(user=user)
komentar = Komentar(fasilitas=fasilitas, user=user_sender)
komentar = KomentarFasilitas(informasi=fasilitas, user=user_sender)
ret_fcm_device = utils.get_target_fcm_device(komentar)
......@@ -124,64 +124,45 @@ class TestUtilsNotification(BaseTestNotification):
fcmdevice.save()
fasilitas = Fasilitas(user=user)
komentar = Komentar(fasilitas=fasilitas, user=user)
komentar = KomentarFasilitas(informasi=fasilitas, user=user)
ret_fcm_device = utils.get_target_fcm_device(komentar)
self.assertEqual(len(ret_fcm_device), 0)
def test_get_formatted_username_length_less_than_max_length_name_should_not_get_trimmed(self):
username = 'ariq'
ret_username = utils.get_formatted_user_name(username, max_length_name=10)
self.assertEqual(username, ret_username)
def test_get_formatted_message(self):
komentar = MagicMock()
komentar.deskripsi = 'ini deskripsi'
ret_formatted_message = utils.get_formatted_message(komentar)
self.assertEqual(ret_formatted_message, '"%s"' % komentar.deskripsi)
def test_get_formatted_username_length_equal_max_length_name_should_not_get_trimmed(self):
username = 'ariqbasyar'
ret_username = utils.get_formatted_user_name(username, max_length_name=10)
self.assertEqual(username, ret_username)
def test_get_formatted_username_length_more_than_max_length_name_should_get_trimmed(self):
username = 'ariqbasyarr'
max_length_name = 10
replacement_str = '...'
length_replacement = len(replacement_str)
ret_username = utils.get_formatted_user_name(username, max_length_name=max_length_name,
replacement_str=replacement_str)
self.assertEqual(ret_username, '%s%s' % (username[:max_length_name - length_replacement],
replacement_str))
self.assertEqual(ret_username, 'ariqbas...')
def test_get_formatted_message_username_should_not_get_trimmed(self):
username = 'ariqbasyar'
ret_formatted_message = utils.get_formatted_message(username)
self.assertEqual(ret_formatted_message, 'ariqbasyar menambahkan komentar baru')
def test_get_formatted_message_username_should_get_trimmed(self):
username = 'ariqbasyarr'
ret_formatted_message = utils.get_formatted_message(username)
self.assertEqual(ret_formatted_message, 'ariqbas... menambahkan komentar baru')
def test_get_formatted_title(self):
username = 'dummy username'
ret_formatted_title = utils.get_formatted_title(username)
self.assertEqual(ret_formatted_title, 'dummy username menambahkan komentar baru')
@patch('notification.utils.get_target_fcm_device')
@patch('notification.utils.get_formatted_message')
@patch('notification.utils.get_formatted_title')
@patch('notification.utils.get_sender_last_name_from_komentar')
@patch('notification.utils.get_type_informasi_from_komentar')
@patch('notification.utils.get_informasi_id_from_komentar')
@patch('notification.utils.get_place_id_from_komentar')
def test_send_komentar_notification(self, *args):
komentar = Komentar(deskripsi='dummy deskripsi')
komentar = KomentarFasilitas(deskripsi='dummy deskripsi')
fcmdevice_mock = QuerySet(model=FCMDevice)
fcmdevice_mock_return_value = (1,1,0,0,[])
fcmdevice_mock.send_message = MagicMock(return_value=fcmdevice_mock_return_value)
formatted_message = 'ariqbasyar menambahkan komentar baru'
formatted_title = 'ariqbasyar menambahkan komentar baru'
formatted_message = 'ini komentar'
args[0].return_value = 'dummy place_id'
args[1].return_value = 1
args[2].return_value = 'fasilitas'
args[3].return_value = 'ariqbasyar'
args[4].return_value = formatted_message
args[5].return_value = fcmdevice_mock
args[4].return_value = formatted_title
args[5].return_value = formatted_message
args[6].return_value = fcmdevice_mock
ret = utils.send_komentar_notification(komentar)
......@@ -192,13 +173,15 @@ class TestUtilsNotification(BaseTestNotification):
args[3].assert_called_once_with(komentar)
args[4].assert_called_once_with('ariqbasyar')
args[5].assert_called_once_with(komentar)
args[6].assert_called_once_with(komentar)
fcmdevice_mock.send_message.assert_called_once_with(
title=formatted_message,
body='"%s"' % komentar.deskripsi,
title=formatted_title,
body=formatted_message,
data={
'place_id': 'dummy place_id',
'id': 1,
'type': 'fasilitas',
'title': formatted_title,
'message': formatted_message,
}
)
......@@ -6,7 +6,7 @@ from django.contrib.auth.models import User
from fcm_django.models import FCMDevice, AbstractFCMDevice
from fcm_django.api.rest_framework import FCMDeviceSerializer
from informasi_fasilitas.models import Lokasi, Kegiatan, Fasilitas, Komentar, KomentarKegiatan