Fakultas Ilmu Komputer UI

Commit e6e4df73 authored by Saul Andre's avatar Saul Andre
Browse files

[REFACTOR] pull lastest code from staging

parents 437c99b8 bbe371fd
......@@ -14,7 +14,10 @@
<title>Unggah Materi</title>
<!-- Custom fonts for this template -->
<<<<<<< HEAD
<link rel="icon" type="image/png" href="{% static 'images/icons/logo.ico' %}" />
=======
>>>>>>> bbe371fd4c3a98864a1537c2c6e0e7104a8e1af7
<link href="https://fonts.googleapis.com/css2?family=Poppins&display=swap" rel="stylesheet">
<!-- Custom styles for this template -->
......@@ -46,6 +49,7 @@
<!-- Nav Item - Dashboard -->
<li class="nav-item">
<<<<<<< HEAD
<a class="nav-link" href="{% url 'unggah' %}">
<span>Unggah Materi</span>
</a>
......@@ -61,6 +65,15 @@
<a class="nav-link" href="#">
<span>Statisik Materi</span>
</a>
=======
<a class="nav-link" href="{% url 'dashboard' %}">
<span>Beranda</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="{% url 'unggah' %}">
<span>Unggah Materi</span></a>
>>>>>>> bbe371fd4c3a98864a1537c2c6e0e7104a8e1af7
</li>
</ul>
......@@ -86,8 +99,13 @@
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<<<<<<< HEAD
<a class="nav-link" href="/dashboard/">
<span class="mr-2 d-none d-lg-inline text-gray-600 small">Dasbor</span>
=======
<a class="nav-link" href="/unggah/">
<span class="mr-2 d-none d-lg-inline text-gray-600 small">Unggah</span>
>>>>>>> bbe371fd4c3a98864a1537c2c6e0e7104a8e1af7
</a>
</li>
......@@ -109,9 +127,15 @@
<li class="nav-item dropdown no-arrow">
<a class="nav-link dropdown-toggle" href="#" id="userDropdown" role="button"
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<<<<<<< HEAD
<span class="mr-2 d-none d-lg-inline text-gray-600 small">{{ user.name }}</span>
<img class="img-profile rounded-circle"
src="{{ user.profile_picture.url }}">
=======
<span class="mr-2 d-none d-lg-inline text-gray-600 small">Admin</span>
<img class="img-profile rounded-circle"
src="https://source.unsplash.com/QAB-WJcbgJk/60x60">
>>>>>>> bbe371fd4c3a98864a1537c2c6e0e7104a8e1af7
</a>
</li>
......@@ -127,6 +151,7 @@
<div class="col-20">
<h1 class="mt-2">Upload Materi</h1>
<hr class="mt-0 mb-4">
<<<<<<< HEAD
{% if messages %}
{% for message in messages %}
{% if message.level == DEFAULT_MESSAGE_LEVELS.SUCCESS %}
......@@ -150,6 +175,16 @@
<p> </p>
{{ field.errors }}
<p> </p>
=======
<form form id="add_form" method="POST" action="" novalidate enctype="multipart/form-data">
{% csrf_token %}
{% for field in form%}
<div class="col-md-6">
<div class="fieldWrapper">
{{ field.label_tag }} {{ field }}
{{ field.errors }}
>>>>>>> bbe371fd4c3a98864a1537c2c6e0e7104a8e1af7
{% if field.help_text %}
<p class="help">{{ field.help_text|safe }}</p>
{% endif %}
......
......@@ -2,9 +2,13 @@ import json
from django.contrib.auth import get_user_model
from django.core import serializers
<<<<<<< HEAD
from django.core.files import File
from django.core.files.uploadedfile import SimpleUploadedFile
from django.test import Client, RequestFactory, TestCase
=======
from django.test import Client, TestCase, RequestFactory
>>>>>>> bbe371fd4c3a98864a1537c2c6e0e7104a8e1af7
from django.urls import resolve
from administration.utils import id_generator
......@@ -17,6 +21,9 @@ from .views import (DaftarKatalog, DashboardKontributorView, DetailMateri,
SuksesLoginKontributorView, SuntingProfilView,
ProfilAdminView)
from app.views import UploadMateriHTML, UploadMateriView
from authentication.models import User
class DaftarKatalogTest(TestCase):
def test_daftar_katalog_url_exist(self):
......@@ -44,6 +51,7 @@ class DaftarKatalogTest(TestCase):
class DetailMateriTest(TestCase):
<<<<<<< HEAD
def setUp(self):
self.client = Client()
self.admin_credential = {
......@@ -83,6 +91,8 @@ class DetailMateriTest(TestCase):
def test_detail_materi_using_detail_materi_template(self):
response = Client().get(self.url)
self.assertTemplateUsed(response, 'app/detail_materi.html')
=======
>>>>>>> bbe371fd4c3a98864a1537c2c6e0e7104a8e1af7
def test_detail_materi_using_detail_materi_func(self):
found = resolve(self.url)
......@@ -186,12 +196,17 @@ class TemplateLoaderTest(TestCase):
class UploadPageTest(TestCase):
def setUp(self):
<<<<<<< HEAD
self.client = Client()
=======
self.client=Client()
>>>>>>> bbe371fd4c3a98864a1537c2c6e0e7104a8e1af7
self.user = User.objects._create_user(email="kontributor@gov.id",
password="kontributor", is_contributor=True)
def test_upload_page_using_login_func(self):
found = resolve("/unggah/")
<<<<<<< HEAD
self.assertEqual(found.func.__name__,
UploadMateriView.as_view().__name__)
......@@ -205,13 +220,31 @@ class UploadPageTest(TestCase):
# Negative tests
self.client.login(email="kontributor@gov.id",
password="kontributor")
=======
self.assertEqual(found.func.__name__, UploadMateriView.as_view().__name__)
def test_uplaod_page_url_is_exist(self):
#Positive test
self.client.login(email="kontributor@gov.id",
password="kontributor")
response = self.client.get("/unggah/")
self.assertEqual(response.status_code,200)
# Negative tests
self.client.login(email="kontributor@gov.id",
password="kontributor")
>>>>>>> bbe371fd4c3a98864a1537c2c6e0e7104a8e1af7
response = Client().get("/fake/")
self.assertEqual(response.status_code, 404)
def test_upload_page_template(self):
url = "/unggah/"
self.client.login(email="kontributor@gov.id",
<<<<<<< HEAD
password="kontributor")
=======
password="kontributor")
>>>>>>> bbe371fd4c3a98864a1537c2c6e0e7104a8e1af7
response = self.client.get(url)
expected_template_name = "unggah.html"
self.assertTemplateUsed(response, expected_template_name)
......@@ -238,7 +271,6 @@ class UploadPageTest(TestCase):
# Negative tests
self.assertNotContains(response, "anything")
class DashboardKontributorViewTest(TestCase):
def setUp(self):
self.client = Client()
......
......@@ -129,7 +129,6 @@ def download_materi(request, pk):
else:
raise Http404("File tidak dapat ditemukan.")
def view_materi(request, pk):
materi = get_object_or_404(Materi, pk=pk)
path = materi.content.path
......@@ -144,7 +143,6 @@ def view_materi(request, pk):
else:
raise Http404("File tidak dapat ditemukan.")
class UploadMateriView(TemplateView):
template_name = "unggah.html"
context = {}
......@@ -184,7 +182,6 @@ class UploadMateriView(TemplateView):
class UploadMateriHTML(TemplateView):
template_name = "unggah.html"
context = {}
def get_template_names(self):
if self.request.path == "/unggah/":
template_name = "unggah.html"
......
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