Fakultas Ilmu Komputer UI

Commit ab6a57a9 authored by Nurma Ayu Wigati S. Subroto's avatar Nurma Ayu Wigati S. Subroto
Browse files

[#45] Update Rating

parent b88111ad
Pipeline #60703 passed with stages
in 21 minutes and 5 seconds
......@@ -49,7 +49,7 @@ from app.forms import SuntingProfilForm, year_choices, GuestBookForm
from app.utils.fileManagementUtil import (get_random_filename,
remove_image_exifdata)
from app.utils.PasswordValidator import PasswordPolicyValidator
from app.views import UploadMateriHTML, add_rating_materi
from app.views import UploadMateriHTML, add_rating_materi, edit_rating_materi
from .models import (Category, Comment, DislikeComment, DownloadStatistics,
Like, LikeComment, Materi, Rating, RatingContributor,
......@@ -2338,6 +2338,10 @@ class RatingMateriTest(TestCase):
def test_rating_materi_url_use_add_rating_materi_function(self):
found = resolve(self.url_rate)
self.assertEqual(found.func, add_rating_materi)
def test_rating_materi_url_use_edit_rating_materi_function(self):
found = resolve(self.url_rate)
self.assertEqual(found.func, add_rating_materi)
def test_rating_materi_get_method_should_return_403_forbidden(self):
response = self.client.get(self.url_rate)
......@@ -2589,6 +2593,11 @@ class RatingContributorTest(TransactionTestCase):
score=3, contributor=self.contributor, user=self.anonymous)
self.assertEqual(1, RatingContributor.objects.count())
def test_edit_rating_contributor(self):
RatingContributor.objects.create(
score=3, contributor=self.contributor, user=self.anonymous)
self.assertEqual(1, RatingContributor.objects.count())
def test_add_rating_contributor_should_failed_when_negative(self):
with self.assertRaises(ValidationError):
RatingContributor.objects.create(
......
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