Fakultas Ilmu Komputer UI

Commit 62e21534 authored by Mutia Rahmatun Husna's avatar Mutia Rahmatun Husna
Browse files

[REFACTOR] fix conflict when merge

parent c9c0b613
Pipeline #58937 passed with stages
in 21 minutes and 48 seconds
......@@ -16,7 +16,6 @@ from django.core.management import call_command
from django.test import Client, TestCase, TransactionTestCase
from django.urls import resolve, reverse
from django.db.utils import IntegrityError
from django.urls import resolve
from django.test import Client, RequestFactory, TestCase, TransactionTestCase
from pytz import timezone
from time import sleep
......@@ -59,12 +58,12 @@ from .views import (
UploadMateriExcelView,
PasswordChangeViews,
password_success,
MateriFavorite
MateriFavorite,
)
from app.forms import SuntingProfilForm, year_choices
from app.utils.fileManagementUtil import get_random_filename, remove_image_exifdata
ERROR_403_MESSAGE = 'Kamu harus login untuk mengakses halaman ini'
ERROR_403_MESSAGE = "Kamu harus login untuk mengakses halaman ini"
from django.test import LiveServerTestCase
from selenium import webdriver
......@@ -237,7 +236,7 @@ class DaftarKatalogPerKontributorTest(TestCase):
response = self.client.get(self.url)
list_materi = Materi.objects.filter(uploader=self.contributor)
data = response.context_data['materi_list']
data = response.context_data["materi_list"]
self.assertEqual(len(list_materi), len(data))
......@@ -290,7 +289,7 @@ class DetailMateriTest(TestCase):
def test_detail_materi_using_detail_materi_template(self):
response = Client().get(self.url)
self.assertTemplateUsed(response, 'app/detail_materi.html')
self.assertTemplateUsed(response, "app/detail_materi.html")
def test_detail_materi_using_detail_materi_func(self):
found = resolve(self.url)
......@@ -492,30 +491,28 @@ class DetailMateriTest(TestCase):
def test_tombol_citasiAPA(self):
response = self.client.get(self.url)
self.assertContains(response, 'Citate APA')
self.assertContains(response, "Citate APA")
def test_hasil_citasi_APA_materi_has_no_published_date(self):
response = self.client.get(self.url)
expected = self.materi1.author + \
' . (n.d) . ' + \
self.materi1.title + \
' . ' + \
self.materi1.publisher
expected = self.materi1.author + " . (n.d) . " + self.materi1.title + " . " + self.materi1.publisher
self.assertIn(expected, response.context["citationAPA"])
self.assertIn(expected,
response.context["citationAPA"])
def test_hasil_citasi_APA_materi_has_published_date(self):
response = self.client.get(self.materi_with_published_date_url)
published_date = self.materi_with_published_date.published_date.strftime('%Y-%m-%d %H:%M')
expected = self.materi_with_published_date.author + \
' . (' + \
published_date + \
') . ' + \
self.materi_with_published_date.title + \
' . ' + \
self.materi_with_published_date.publisher
self.assertIn(expected,
response.context["citationAPA"])
published_date = self.materi_with_published_date.published_date.strftime("%Y-%m-%d %H:%M")
expected = (
self.materi_with_published_date.author
+ " . ("
+ published_date
+ ") . "
+ self.materi_with_published_date.title
+ " . "
+ self.materi_with_published_date.publisher
)
self.assertIn(expected, response.context["citationAPA"])
def test_citation_IEEE_button(self):
response = self.client.get(self.url)
......@@ -528,12 +525,20 @@ class DetailMateriTest(TestCase):
current_month = current_date.strftime("%b")
current_year = str(current_date.year)
expected = "Agas, " + \
"Materi 1. " + \
"Kelas SC, n.d. " + \
"Accessed on: " + current_month + ". " + current_day + ", " + current_year + \
". [Online]. " + \
"Available: http://testserver" + self.url
expected = (
"Agas, "
+ "Materi 1. "
+ "Kelas SC, n.d. "
+ "Accessed on: "
+ current_month
+ ". "
+ current_day
+ ", "
+ current_year
+ ". [Online]. "
+ "Available: http://testserver"
+ self.url
)
self.assertIn(expected, response.context["citationIEEE"])
def test_citation_IEEE_materi_has_published_date(self):
......@@ -1671,35 +1676,6 @@ class RevisiMateriTest(TestCase):
# Logout
self.client.logout()
class NameBannerFunctionalTest(LiveServerTestCase):
selenium = None
@classmethod
def setUpClass(cls):
super().setUpClass()
options = Options()
options.add_argument('--headless')
options.add_argument("start-maximized")
options.add_argument("disable-infobars")
options.add_argument("--disable-extensions")
options.add_argument("--disable-dev-shm-usage")
options.add_argument("--no-sandbox")
options.add_argument("--no-sandbox")
cls.selenium = webdriver.Chrome(ChromeDriverManager().install(),
chrome_options=options)
cls.selenium.implicitly_wait(10)
@classmethod
def tearDownClass(cls):
cls.selenium.quit()
super().tearDownClass()
def test_list_todo_available(self):
self.selenium.get(f'{self.live_server_url}')
try:
self.assertIn('Digipus', self.selenium.find_element_by_css_selector('nav.katalog-navbar').text)
except NoSuchElementException:
self.fail('No such element: Katalog Brand')
class GenerateDummyCommandTest(TestCase):
def setUp(self):
......
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