Fakultas Ilmu Komputer UI
Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
PMPL
Collection of Practice
2019
1506722765-practice
Commits
d97317fa
Commit
d97317fa
authored
Dec 23, 2019
by
jordan
Browse files
hotfix merge to master
parent
6306d48b
Pipeline
#28513
failed with stages
in 1 minute and 37 seconds
Changes
8
Pipelines
1
Show whitespace changes
Inline
Side-by-side
.coverage
View file @
d97317fa
No preview for this file type
functional_test/base.py
View file @
d97317fa
...
...
@@ -11,7 +11,6 @@ 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"
)
...
...
@@ -20,15 +19,6 @@ 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
)
>>>>>>>
119
b2431b139e52a82030f75f519a6dcd4e56364
def
tearDown
(
self
):
self
.
browser
.
quit
()
...
...
@@ -70,15 +60,7 @@ 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
()
>>>>>>>
119
b2431b139e52a82030f75f519a6dcd4e56364
functional_test/test_header_footer.py
View file @
d97317fa
...
...
@@ -6,7 +6,6 @@ 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
...
...
@@ -22,18 +21,3 @@ 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
)
>>>>>>>
119
b2431b139e52a82030f75f519a6dcd4e56364
functional_test/test_login.py
View file @
d97317fa
...
...
@@ -50,56 +50,20 @@ 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"))
>>>>>>>
119
b2431b139e52a82030f75f519a6dcd4e56364
# 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")
>>>>>>>
119
b2431b139e52a82030f75f519a6dcd4e56364
# 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)
>>>>>>>
119
b2431b139e52a82030f75f519a6dcd4e56364
# self.wait_to_be_logged_out(email=TEST_EMAIL)
functional_test/test_simple_list_creation.py
View file @
d97317fa
...
...
@@ -47,7 +47,6 @@ 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"
)
...
...
@@ -56,15 +55,6 @@ 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
)
>>>>>>>
119
b2431b139e52a82030f75f519a6dcd4e56364
# Francis visits the home page. There is no sign of Edith's
# list
...
...
lists/templates/base.html
View file @
d97317fa
...
...
@@ -35,15 +35,11 @@
}
</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>
...
...
@@ -106,15 +102,11 @@
</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>
lists/tests/test_views.py
View file @
d97317fa
...
...
@@ -55,13 +55,8 @@ 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"
)
>>>>>>>
119
b2431b139e52a82030f75f519a6dcd4e56364
def
test_saving_a_POST_request
(
self
):
self
.
client
.
post
(
"/lists/new"
,
data
=
{
"item_text"
:
"A new list item"
})
...
...
@@ -79,19 +74,10 @@ 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"
)
>>>>>>>
119
b2431b139e52a82030f75f519a6dcd4e56364
class
ListViewTest
(
TestCase
):
...
...
@@ -147,7 +133,6 @@ 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"
)
...
...
@@ -156,27 +141,11 @@ 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'
)
>>>>>>>
119
b2431b139e52a82030f75f519a6dcd4e56364
def
test_message_waktunya_libur
(
self
):
result
=
get_comment
(
0
)
self
.
assertEqual
(
result
,
"yey, waktunya berlibur"
)
<<<<<<<
HEAD
=======
>>>>>>>
119
b2431b139e52a82030f75f519a6dcd4e56364
def
test_message_oh_tidak
(
self
):
result
=
get_comment
(
5
)
self
.
assertEqual
(
result
,
"oh tidak"
)
lists/views.py
View file @
d97317fa
...
...
@@ -25,7 +25,6 @@ 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"
}
...
...
@@ -52,31 +51,6 @@ 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
()
)})
>>>>>>>
119
b2431b139e52a82030f75f519a6dcd4e56364
def
get_comment
(
count
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment