Fakultas Ilmu Komputer UI

Commit 6306d48b authored by jordan's avatar jordan
Browse files

hotfix

parents ed759cfd 119b2431
Pipeline #28500 failed with stages
in 1 minute and 31 seconds
......@@ -11,6 +11,7 @@ MAX_WAIT = 10
class FunctionalTest(StaticLiveServerTestCase):
def setUp(self):
chrome_options = Options()
<<<<<<< HEAD
chrome_options.add_argument("--dns-prefetch-disable")
chrome_options.add_argument("--no-sandbox")
chrome_options.add_argument("--headless")
......@@ -19,6 +20,15 @@ class FunctionalTest(StaticLiveServerTestCase):
executable_path="./chromedriver", options=chrome_options
)
self.browser.implicitly_wait(10)
=======
chrome_options.add_argument('--dns-prefetch-disable')
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--headless')
chrome_options.add_argument('disable-gpu')
self.browser = webdriver.Chrome(executable_path="./chromedriver", options=chrome_options)
self.browser.implicitly_wait(10)
>>>>>>> 119b2431b139e52a82030f75f519a6dcd4e56364
def tearDown(self):
self.browser.quit()
......@@ -60,7 +70,15 @@ class FunctionalTest(StaticLiveServerTestCase):
self.browser.find_element_by_name("email")
navbar = self.browser.find_element_by_css_selector(".navbar")
self.assertNotIn(email, navbar.text)
<<<<<<< HEAD
@wait
def wait_for(self, fn):
return fn()
=======
@wait
def wait_for(self, fn):
return fn()
>>>>>>> 119b2431b139e52a82030f75f519a6dcd4e56364
......@@ -6,6 +6,7 @@ class HeaderAndFooter(FunctionalTest):
# Masuk halaman to do list
self.browser.get(self.live_server_url)
<<<<<<< HEAD
# Terdapat nama mahasiswa yang memiliki web pada bagian header
# beserta nama fungsi web nya.
header_1 = self.browser.find_element_by_id("header_1").text
......@@ -21,3 +22,18 @@ class HeaderAndFooter(FunctionalTest):
self.assertIn("Copyright Jordan Muhammad Andrianda", footer_1)
#Pengecekan Tugas Akhir Programming No 1 sudah diselesaikan
=======
# Terdapat nama mahasiswa yang memiliki web pada bagian header
# beserta nama fungsi web nya.
header_1 = self.browser.find_element_by_id('header_1').text
# Nama mahasiswa tersebut adalah Jordan Muhammad Andrianda,
# sehingga di header terdapat nama tersebut.
self.assertIn('Jordan Muhammad Andrianda To Do list App', header_1)
# Terdapat nama mahasiswa yang memiliki web pada bagian footer
# beserta copyright web nya.
footer_1 = self.browser.find_element_by_id('footer_1').text
# Nama mahasiswa tersebut adalah Jordan Muhammad Andrianda,
# sehingga di footer terdapat nama tersebut.
self.assertIn('Copyright Jordan Muhammad Andrianda', footer_1)
>>>>>>> 119b2431b139e52a82030f75f519a6dcd4e56364
......@@ -50,20 +50,56 @@ class LoginTest(FunctionalTest):
# self.assertIn(TEST_EMAIL, navbar.text)
<<<<<<< HEAD
# # Now she logs out
=======
# # self.wait_for(lambda: self.browser.find_element_by_link_text("Log out"))
>>>>>>> 119b2431b139e52a82030f75f519a6dcd4e56364
# self.browser.find_element_by_link_text("Log out").click()
# # She is logged out
<<<<<<< HEAD
# self.wait_for(lambda: self.browser.find_element_by_name("email"))
=======
# navbar = self.browser.find_element_by_css_selector(".navbar")
>>>>>>> 119b2431b139e52a82030f75f519a6dcd4e56364
# navbar = self.browser.find_element_by_css_selector(".navbar")
<<<<<<< HEAD
# self.assertNotIn(TEST_EMAIL, navbar.text)
# self.wait_to_be_logged_in(email=TEST_EMAIL)
# self.browser.find_element_by_link_text('Log out').click()
=======
# self.assertIn(TEST_EMAIL, navbar.text)
# # Now she logs out
# self.browser.find_element_by_link_text("Log out").click()
# # She is logged out
# self.wait_for(lambda: self.browser.find_element_by_name("email"))
# navbar = self.browser.find_element_by_css_selector(".navbar")
# self.assertNotIn(TEST_EMAIL, navbar.text)
# self.wait_to_be_logged_in(email=TEST_EMAIL)
# self.browser.find_element_by_link_text('Log out').click()
# self.wait_to_be_logged_out(email=TEST_EMAIL)
>>>>>>> 119b2431b139e52a82030f75f519a6dcd4e56364
# self.wait_to_be_logged_out(email=TEST_EMAIL)
......@@ -47,6 +47,7 @@ class NewVisitorTest(FunctionalTest):
## of Edith's is coming through from cookies etc #
self.browser.quit()
chrome_options = Options()
<<<<<<< HEAD
chrome_options.add_argument("--dns-prefetch-disable")
chrome_options.add_argument("--no-sandbox")
chrome_options.add_argument("--headless")
......@@ -55,6 +56,15 @@ class NewVisitorTest(FunctionalTest):
executable_path="./chromedriver", options=chrome_options
)
self.browser.implicitly_wait(10)
=======
chrome_options.add_argument('--dns-prefetch-disable')
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--headless')
chrome_options.add_argument('disable-gpu')
self.browser = webdriver.Chrome(executable_path="./chromedriver", options=chrome_options)
self.browser.implicitly_wait(10)
>>>>>>> 119b2431b139e52a82030f75f519a6dcd4e56364
# Francis visits the home page. There is no sign of Edith's
# list
......
......@@ -35,11 +35,15 @@
}
</style>
</head>
<<<<<<< HEAD
<header>
<div class="headerBar">
<a id="header_1">Jordan Muhammad Andrianda To Do list App</a>
</div>
</header>
=======
<header style="margin-left: 50%;"> <h3 id="header_1">Jordan Muhammad Andrianda To Do list App</h3></header>
>>>>>>> 119b2431b139e52a82030f75f519a6dcd4e56364
<body>
<div class="navigationBar">
<a id="navbar_1">Dibuat untuk menyelesaikan Tugas Ujian Akhir Penjaminan Mutu Perangkat Lunak 2019</a>
......@@ -102,11 +106,15 @@
</div>
</div>
</body>
<<<<<<< HEAD
<footer>
<div class="footerBar">
<a id="footer_1">Copyright Jordan Muhammad Andrianda</a>
</div>
</footer>
=======
<footer style="margin-left: 50%;"><h3 id="footer_1">Copyright Jordan Muhammad Andriandaa</h3></footer>
>>>>>>> 119b2431b139e52a82030f75f519a6dcd4e56364
</html>
......@@ -55,8 +55,13 @@ class HomePageTest(TestCase):
class NewListTest(TestCase):
def test_can_not_save_an_empty_POST_request(self):
<<<<<<< HEAD
response = self.client.post("/lists/new", data={"item_text": ""})
self.assertEqual(response.context["error"], "You can't have an empty list item")
=======
response = self.client.post('/lists/new', data={'item_text': ''})
self.assertEqual(response.context['error'], "You can't have an empty list item")
>>>>>>> 119b2431b139e52a82030f75f519a6dcd4e56364
def test_saving_a_POST_request(self):
self.client.post("/lists/new", data={"item_text": "A new list item"})
......@@ -74,10 +79,19 @@ class NewListTest(TestCase):
correct_list = List.objects.create()
response = self.client.post(
<<<<<<< HEAD
f"/lists/{correct_list.id}/add_item", data={"item_text": ""}
)
self.assertEqual(response.context["error"], "You can't have an empty list item")
=======
f'/lists/{correct_list.id}/add_item',
data={'item_text': ''}
)
self.assertEqual(response.context['error'], "You can't have an empty list item")
>>>>>>> 119b2431b139e52a82030f75f519a6dcd4e56364
class ListViewTest(TestCase):
......@@ -133,6 +147,7 @@ class NewItemTest(TestCase):
def test_view_list(self):
other_list = List.objects.create()
correct_list = List.objects.create()
<<<<<<< HEAD
response = self.client.post("/lists/%d/" % (correct_list.id,))
self.assertTemplateUsed(response, "list.html")
......@@ -141,11 +156,27 @@ class GenereateCommentTest(TestCase):
def test_message_sibuk_santai(self):
result = get_comment(1)
self.assertEqual(result, "sibuk tapi santai")
=======
response = self.client.post(
"/lists/%d/" % (correct_list.id,)
)
self.assertTemplateUsed(response, "list.html")
class GenereateCommentTest(TestCase):
def test_message_sibuk_santai(self):
result = get_comment(1)
self.assertEqual(result, 'sibuk tapi santai')
>>>>>>> 119b2431b139e52a82030f75f519a6dcd4e56364
def test_message_waktunya_libur(self):
result = get_comment(0)
self.assertEqual(result, "yey, waktunya berlibur")
<<<<<<< HEAD
=======
>>>>>>> 119b2431b139e52a82030f75f519a6dcd4e56364
def test_message_oh_tidak(self):
result = get_comment(5)
self.assertEqual(result, "oh tidak")
......@@ -25,6 +25,7 @@ def home_page(request):
def new_list(request):
<<<<<<< HEAD
if len(request.POST["item_text"]) == 0:
return render(
request, "home.html", {"error": "You can't have an empty list item"}
......@@ -51,6 +52,31 @@ def view_list(request, list_id, error=""):
"list.html",
{"error": error, "list": list_, "message": get_comment(list_.item_set.count())},
)
=======
if len(request.POST['item_text']) == 0:
return render(request, 'home.html',
{
'error': "You can't have an empty list item",
})
list_ = List.objects.create()
Item.objects.create(text=request.POST['item_text'], list=list_)
return redirect(f'/lists/{list_.id}/')
def add_item(request,list_id):
if len(request.POST['item_text']) == 0:
error = "You can't have an empty list item"
return view_list(request, list_id, error)
list_ = List.objects.get(id=list_id)
Item.objects.create(text=request.POST['item_text'], list=list_)
return redirect(f'/lists/{list_.id}/')
def view_list(request, list_id, error=''):
list_ = List.objects.get(id=list_id)
return render(request, 'list.html', {'error':error, 'list': list_, 'message': get_comment(list_.item_set.count() )})
>>>>>>> 119b2431b139e52a82030f75f519a6dcd4e56364
def get_comment(count):
......
......@@ -4,6 +4,7 @@ attrs==19.2.0
black==19.3b0
Click==7.0
coverage==5.0
<<<<<<< HEAD
dj-database-url==0.5.0
Django==2.2.5
entrypoints==0.3
......@@ -13,6 +14,14 @@ isort==4.3.21
lazy-object-proxy==1.4.2
mccabe==0.6.1
psycopg2==2.8.4
=======
Django==2.2.5
entrypoints==0.3
flake8==3.7.8
isort==4.3.21
lazy-object-proxy==1.4.2
mccabe==0.6.1
>>>>>>> 119b2431b139e52a82030f75f519a6dcd4e56364
pycodestyle==2.5.0
pyflakes==2.1.1
pylint==2.4.2
......@@ -23,5 +32,8 @@ sqlparse==0.3.0
toml==0.10.0
typed-ast==1.4.0
urllib3==1.25.6
<<<<<<< HEAD
whitenoise==5.0.1
=======
>>>>>>> 119b2431b139e52a82030f75f519a6dcd4e56364
wrapt==1.11.2
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