Fakultas Ilmu Komputer UI

Commit d97317fa authored by jordan's avatar jordan
Browse files

hotfix merge to master

parent 6306d48b
Pipeline #28513 failed with stages
in 1 minute and 37 seconds
No preview for this file type
...@@ -11,7 +11,6 @@ MAX_WAIT = 10 ...@@ -11,7 +11,6 @@ MAX_WAIT = 10
class FunctionalTest(StaticLiveServerTestCase): class FunctionalTest(StaticLiveServerTestCase):
def setUp(self): def setUp(self):
chrome_options = Options() chrome_options = Options()
<<<<<<< HEAD
chrome_options.add_argument("--dns-prefetch-disable") chrome_options.add_argument("--dns-prefetch-disable")
chrome_options.add_argument("--no-sandbox") chrome_options.add_argument("--no-sandbox")
chrome_options.add_argument("--headless") chrome_options.add_argument("--headless")
...@@ -20,15 +19,6 @@ class FunctionalTest(StaticLiveServerTestCase): ...@@ -20,15 +19,6 @@ class FunctionalTest(StaticLiveServerTestCase):
executable_path="./chromedriver", options=chrome_options executable_path="./chromedriver", options=chrome_options
) )
self.browser.implicitly_wait(10) 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): def tearDown(self):
self.browser.quit() self.browser.quit()
...@@ -70,15 +60,7 @@ class FunctionalTest(StaticLiveServerTestCase): ...@@ -70,15 +60,7 @@ class FunctionalTest(StaticLiveServerTestCase):
self.browser.find_element_by_name("email") self.browser.find_element_by_name("email")
navbar = self.browser.find_element_by_css_selector(".navbar") navbar = self.browser.find_element_by_css_selector(".navbar")
self.assertNotIn(email, navbar.text) self.assertNotIn(email, navbar.text)
<<<<<<< HEAD
@wait @wait
def wait_for(self, fn): def wait_for(self, fn):
return fn() return fn()
=======
@wait
def wait_for(self, fn):
return fn()
>>>>>>> 119b2431b139e52a82030f75f519a6dcd4e56364
...@@ -6,7 +6,6 @@ class HeaderAndFooter(FunctionalTest): ...@@ -6,7 +6,6 @@ class HeaderAndFooter(FunctionalTest):
# Masuk halaman to do list # Masuk halaman to do list
self.browser.get(self.live_server_url) self.browser.get(self.live_server_url)
<<<<<<< HEAD
# Terdapat nama mahasiswa yang memiliki web pada bagian header # Terdapat nama mahasiswa yang memiliki web pada bagian header
# beserta nama fungsi web nya. # beserta nama fungsi web nya.
header_1 = self.browser.find_element_by_id("header_1").text header_1 = self.browser.find_element_by_id("header_1").text
...@@ -22,18 +21,3 @@ class HeaderAndFooter(FunctionalTest): ...@@ -22,18 +21,3 @@ class HeaderAndFooter(FunctionalTest):
self.assertIn("Copyright Jordan Muhammad Andrianda", footer_1) self.assertIn("Copyright Jordan Muhammad Andrianda", footer_1)
#Pengecekan Tugas Akhir Programming No 1 sudah diselesaikan #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,56 +50,20 @@ class LoginTest(FunctionalTest): ...@@ -50,56 +50,20 @@ class LoginTest(FunctionalTest):
# self.assertIn(TEST_EMAIL, navbar.text) # self.assertIn(TEST_EMAIL, navbar.text)
<<<<<<< HEAD
# # Now she logs out # # 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() # self.browser.find_element_by_link_text("Log out").click()
# # She is logged out # # She is logged out
<<<<<<< HEAD
# self.wait_for(lambda: self.browser.find_element_by_name("email")) # 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") # navbar = self.browser.find_element_by_css_selector(".navbar")
<<<<<<< HEAD
# self.assertNotIn(TEST_EMAIL, navbar.text) # self.assertNotIn(TEST_EMAIL, navbar.text)
# self.wait_to_be_logged_in(email=TEST_EMAIL) # self.wait_to_be_logged_in(email=TEST_EMAIL)
# self.browser.find_element_by_link_text('Log out').click() # 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) # self.wait_to_be_logged_out(email=TEST_EMAIL)
...@@ -47,7 +47,6 @@ class NewVisitorTest(FunctionalTest): ...@@ -47,7 +47,6 @@ class NewVisitorTest(FunctionalTest):
## of Edith's is coming through from cookies etc # ## of Edith's is coming through from cookies etc #
self.browser.quit() self.browser.quit()
chrome_options = Options() chrome_options = Options()
<<<<<<< HEAD
chrome_options.add_argument("--dns-prefetch-disable") chrome_options.add_argument("--dns-prefetch-disable")
chrome_options.add_argument("--no-sandbox") chrome_options.add_argument("--no-sandbox")
chrome_options.add_argument("--headless") chrome_options.add_argument("--headless")
...@@ -56,15 +55,6 @@ class NewVisitorTest(FunctionalTest): ...@@ -56,15 +55,6 @@ class NewVisitorTest(FunctionalTest):
executable_path="./chromedriver", options=chrome_options executable_path="./chromedriver", options=chrome_options
) )
self.browser.implicitly_wait(10) 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 # Francis visits the home page. There is no sign of Edith's
# list # list
......
...@@ -35,15 +35,11 @@ ...@@ -35,15 +35,11 @@
} }
</style> </style>
</head> </head>
<<<<<<< HEAD
<header> <header>
<div class="headerBar"> <div class="headerBar">
<a id="header_1">Jordan Muhammad Andrianda To Do list App</a> <a id="header_1">Jordan Muhammad Andrianda To Do list App</a>
</div> </div>
</header> </header>
=======
<header style="margin-left: 50%;"> <h3 id="header_1">Jordan Muhammad Andrianda To Do list App</h3></header>
>>>>>>> 119b2431b139e52a82030f75f519a6dcd4e56364
<body> <body>
<div class="navigationBar"> <div class="navigationBar">
<a id="navbar_1">Dibuat untuk menyelesaikan Tugas Ujian Akhir Penjaminan Mutu Perangkat Lunak 2019</a> <a id="navbar_1">Dibuat untuk menyelesaikan Tugas Ujian Akhir Penjaminan Mutu Perangkat Lunak 2019</a>
...@@ -106,15 +102,11 @@ ...@@ -106,15 +102,11 @@
</div> </div>
</div> </div>
</body> </body>
<<<<<<< HEAD
<footer> <footer>
<div class="footerBar"> <div class="footerBar">
<a id="footer_1">Copyright Jordan Muhammad Andrianda</a> <a id="footer_1">Copyright Jordan Muhammad Andrianda</a>
</div> </div>
</footer> </footer>
=======
<footer style="margin-left: 50%;"><h3 id="footer_1">Copyright Jordan Muhammad Andriandaa</h3></footer>
>>>>>>> 119b2431b139e52a82030f75f519a6dcd4e56364
</html> </html>
...@@ -55,13 +55,8 @@ class HomePageTest(TestCase): ...@@ -55,13 +55,8 @@ class HomePageTest(TestCase):
class NewListTest(TestCase): class NewListTest(TestCase):
def test_can_not_save_an_empty_POST_request(self): def test_can_not_save_an_empty_POST_request(self):
<<<<<<< HEAD
response = self.client.post("/lists/new", data={"item_text": ""}) response = self.client.post("/lists/new", data={"item_text": ""})
self.assertEqual(response.context["error"], "You can't have an empty list item") 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): def test_saving_a_POST_request(self):
self.client.post("/lists/new", data={"item_text": "A new list item"}) self.client.post("/lists/new", data={"item_text": "A new list item"})
...@@ -79,19 +74,10 @@ class NewListTest(TestCase): ...@@ -79,19 +74,10 @@ class NewListTest(TestCase):
correct_list = List.objects.create() correct_list = List.objects.create()
response = self.client.post( response = self.client.post(
<<<<<<< HEAD
f"/lists/{correct_list.id}/add_item", data={"item_text": ""} f"/lists/{correct_list.id}/add_item", data={"item_text": ""}
) )
self.assertEqual(response.context["error"], "You can't have an empty list item") 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): class ListViewTest(TestCase):
...@@ -147,7 +133,6 @@ class NewItemTest(TestCase): ...@@ -147,7 +133,6 @@ class NewItemTest(TestCase):
def test_view_list(self): def test_view_list(self):
other_list = List.objects.create() other_list = List.objects.create()
correct_list = List.objects.create() correct_list = List.objects.create()
<<<<<<< HEAD
response = self.client.post("/lists/%d/" % (correct_list.id,)) response = self.client.post("/lists/%d/" % (correct_list.id,))
self.assertTemplateUsed(response, "list.html") self.assertTemplateUsed(response, "list.html")
...@@ -156,27 +141,11 @@ class GenereateCommentTest(TestCase): ...@@ -156,27 +141,11 @@ class GenereateCommentTest(TestCase):
def test_message_sibuk_santai(self): def test_message_sibuk_santai(self):
result = get_comment(1) result = get_comment(1)
self.assertEqual(result, "sibuk tapi santai") 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): def test_message_waktunya_libur(self):
result = get_comment(0) result = get_comment(0)
self.assertEqual(result, "yey, waktunya berlibur") self.assertEqual(result, "yey, waktunya berlibur")
<<<<<<< HEAD
=======
>>>>>>> 119b2431b139e52a82030f75f519a6dcd4e56364
def test_message_oh_tidak(self): def test_message_oh_tidak(self):
result = get_comment(5) result = get_comment(5)
self.assertEqual(result, "oh tidak") self.assertEqual(result, "oh tidak")
...@@ -25,7 +25,6 @@ def home_page(request): ...@@ -25,7 +25,6 @@ def home_page(request):
def new_list(request): def new_list(request):
<<<<<<< HEAD
if len(request.POST["item_text"]) == 0: if len(request.POST["item_text"]) == 0:
return render( return render(
request, "home.html", {"error": "You can't have an empty list item"} request, "home.html", {"error": "You can't have an empty list item"}
...@@ -52,31 +51,6 @@ def view_list(request, list_id, error=""): ...@@ -52,31 +51,6 @@ def view_list(request, list_id, error=""):
"list.html", "list.html",
{"error": error, "list": list_, "message": get_comment(list_.item_set.count())}, {"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): def get_comment(count):
......
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