Fakultas Ilmu Komputer UI

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

[RED] add test, template and static files

parent 832dbe34
...@@ -11,6 +11,8 @@ local_settings.py ...@@ -11,6 +11,8 @@ local_settings.py
db.sqlite3 db.sqlite3
db.sqlite3-journal db.sqlite3-journal
media media
*/__pycache__/*
static/
# If your build process includes running collectstatic, then you probably don't need or want to include staticfiles/ # If your build process includes running collectstatic, then you probably don't need or want to include staticfiles/
# in your Git repository. Update and uncomment the following line accordingly. # in your Git repository. Update and uncomment the following line accordingly.
...@@ -185,6 +187,7 @@ pip-selfcheck.json ...@@ -185,6 +187,7 @@ pip-selfcheck.json
!.vscode/tasks.json !.vscode/tasks.json
!.vscode/launch.json !.vscode/launch.json
!.vscode/extensions.json !.vscode/extensions.json
.vscode/
### VisualStudioCode Patch ### ### VisualStudioCode Patch ###
# Ignore all local history of files # Ignore all local history of files
......
...@@ -22,9 +22,7 @@ UnitTest: ...@@ -22,9 +22,7 @@ UnitTest:
- coverage.xml - coverage.xml
SonarScanner: SonarScanner:
image: image: addianto/sonar-scanner-cli:latest
name: sonarsource/sonar-scanner-cli:latest
entrypoint: [""]
stage: sonarqube stage: sonarqube
script: script:
- sonar-scanner - sonar-scanner
...@@ -32,6 +30,9 @@ SonarScanner: ...@@ -32,6 +30,9 @@ SonarScanner:
-Dsonar.login=$SONARQUBE_TOKEN -Dsonar.login=$SONARQUBE_TOKEN
-Dsonar.branch.name=$CI_COMMIT_REF_NAME -Dsonar.branch.name=$CI_COMMIT_REF_NAME
-Dsonar.projectKey=$SONARQUBE_PROJECT_KEY -Dsonar.projectKey=$SONARQUBE_PROJECT_KEY
only:
- master
- staging
Staging: Staging:
image: ruby:2.4 image: ruby:2.4
......
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{"name":"Python: Django test","type":"python","request":"launch","program":"${workspaceFolder}\\manage.py","args":["test"],"django":true},
{
"name": "Python: Django",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}\\manage.py",
"args": [
"runserver",
"--noreload"
],
"django": true
}
]
}
\ No newline at end of file
{
"python.pythonPath": "env\\Scripts\\python.exe"
}
\ No newline at end of file
[![pipeline status](https://gitlab.cs.ui.ac.id/ppl-fasilkom-ui/2020/ppl-c/diskominfo-depok-digipus/marjinal-digipus/badges/master/pipeline.svg)](https://gitlab.cs.ui.ac.id/ppl-fasilkom-ui/2020/ppl-c/diskominfo-depok-digipus/marjinal-digipus/commits/master)
[![coverage report](https://gitlab.cs.ui.ac.id/ppl-fasilkom-ui/2020/ppl-c/diskominfo-depok-digipus/marjinal-digipus/badges/master/coverage.svg)](https://gitlab.cs.ui.ac.id/ppl-fasilkom-ui/2020/ppl-c/diskominfo-depok-digipus/marjinal-digipus/commits/master)
\ No newline at end of file
{% extends "base.html" %}
{% load static %}
{% block title %}Test pages{% endblock %}
{% block header %}
<link rel="stylesheet" type="text/css" href="{% static 'app/katalog_materi.css' %}">
{% endblock header %}
{% block content %}
<div class="container">
<div class="row header">
<div class="col">
<h2 class="pageTitle">Temukan Materi Yang Kamu Mau!</h2>
<p class="description">Cari dengan judul buku, penerbit, atau penulis</p>
<form class="col-6 searchBar">
<div class="form-group">
<input type="email" class="form-control" placeholder="Tulis di sini">
</div>
</form>
</div>
</div>
<div class="row content">
<div class="col-3 sidebar">
<button class="btn">Filter</button>
<button class="btn">Sort</button>
</div>
<div class="col-9 books">
<div class="card book">
<img src="https://scontent.fbdo6-2.fna.fbcdn.net/v/t1.0-9/60274038_2279638138757984_7988420823012605952_n.jpg?_nc_cat=108&_nc_sid=110474&_nc_oc=AQlRDnDhg1kJjuoXEwYCYWosatAaFqwSiZdMmfbX_ORoTXu7cvJoawUihJPCjHXCqr0&_nc_ht=scontent.fbdo6-2.fna&oh=169b2c36df1a49f6a394208f21d09f7b&oe=5E94FF4E"
class="card-img-top" alt="cover"></img>
<div class="card-body">
<h5 class="card-title">Wahyu</h5>
<p class="card-text">Saul Andre Lumban Gaol</p>
<button class="btn btn-book">Baca</button>
<button class="btn btn-book">Detail</button>
</div>
</div>
<div class="card book">
<img src="https://scontent.fbdo6-2.fna.fbcdn.net/v/t1.0-9/60274038_2279638138757984_7988420823012605952_n.jpg?_nc_cat=108&_nc_sid=110474&_nc_oc=AQlRDnDhg1kJjuoXEwYCYWosatAaFqwSiZdMmfbX_ORoTXu7cvJoawUihJPCjHXCqr0&_nc_ht=scontent.fbdo6-2.fna&oh=169b2c36df1a49f6a394208f21d09f7b&oe=5E94FF4E"
class="card-img-top" alt="cover"></img>
<div class="card-body">
<h5 class="card-title">Wahyu</h5>
<p class="card-text">Saul Andre Lumban Gaol</p>
<button class="btn btn-book">Baca</button>
<button class="btn btn-book">Detail</button>
</div>
</div>
<div class="card book">
<img src="https://scontent.fbdo6-2.fna.fbcdn.net/v/t1.0-9/60274038_2279638138757984_7988420823012605952_n.jpg?_nc_cat=108&_nc_sid=110474&_nc_oc=AQlRDnDhg1kJjuoXEwYCYWosatAaFqwSiZdMmfbX_ORoTXu7cvJoawUihJPCjHXCqr0&_nc_ht=scontent.fbdo6-2.fna&oh=169b2c36df1a49f6a394208f21d09f7b&oe=5E94FF4E"
class="card-img-top" alt="cover"></img>
<div class="card-body">
<h5 class="card-title">Wahyu</h5>
<p class="card-text">Saul Andre Lumban Gaol</p>
<button class="btn btn-book">Baca</button>
<button class="btn btn-book">Detail</button>
</div>
</div>
</div>
</div>
</div>
{% endblock %}
from django.test import TestCase from django.test import TestCase, Client
from django.urls import resolve
from .views import DaftarKatalog
# Create your tests here. class DaftarKatalogTest(TestCase):
def test_daftar_katalog_url_exist(self):
url = "/"
response = Client().get(f'{url}')
self.assertEqual(response.status_code,200)
def test_daftar_katalog_using_daftar_katalog_template(self):
response = Client().get('/')
self.assertTemplateUsed(response, 'app/katalog_materi.html')
def test_daftar_katalog_using_daftar_katalog_func(self):
found = resolve('/')
self.assertEqual(found.func.__name__, DaftarKatalog.as_view().__name__)
class TemplateLoaderTest(TestCase):
def test_template_loader_url_exist(self):
url = "/test-page.html"
response = Client().get(url)
self.assertEqual(response.status_code,200)
def test_template_loader_using_template_loader_template(self):
url = "/test-page.html"
response = Client().get(url)
expected_template_name = "test-page.html"
self.assertTemplateUsed(response, expected_template_name)
def test_template_loader_using_template_loader_func(self):
url = "/test-page.html"
found = resolve(url)
expected_view_name = "pages"
self.assertEqual(found.func.__name__, expected_view_name)
def test_template_loader_handle_non_existent_html(self):
url = "/test.html"
expected_template_name = "error-404.html"
response = Client().get(url)
self.assertEqual(response.status_code,200)
self.assertTemplateUsed(response, expected_template_name)
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