Fakultas Ilmu Komputer UI
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
1
1606823475-practice
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PMPL
Collection of Practice
2019
1606823475-practice
Commits
d37a4134
Commit
d37a4134
authored
5 years ago
by
Muhammad Ilham Peruzzi
Browse files
Options
Downloads
Patches
Plain Diff
[RED] add unit test for delete feature
parent
4dfa0ba5
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lists/tests/test_views.py
+10
-2
10 additions, 2 deletions
lists/tests/test_views.py
with
10 additions
and
2 deletions
lists/tests/test_views.py
+
10
−
2
View file @
d37a4134
...
...
@@ -4,7 +4,7 @@ from django.http import HttpRequest
from
django.template.loader
import
render_to_string
from
lists.models
import
Item
,
List
from
lists.views
import
home_page
,
about_me
,
view_list
from
lists.views
import
home_page
,
about_me
,
view_list
,
delete_todo
class
ListViewTest
(
TestCase
):
...
...
@@ -46,4 +46,12 @@ class ListViewTest(TestCase):
other_list
=
List
.
objects
.
create
()
correct_list
=
List
.
objects
.
create
()
response
=
self
.
client
.
get
(
'
/lists/%d/
'
%
(
correct_list
.
id
,))
self
.
assertEqual
(
response
.
context
[
'
list
'
],
correct_list
)
\ No newline at end of file
self
.
assertEqual
(
response
.
context
[
'
list
'
],
correct_list
)
def
test_todo_can_be_deleted
(
self
):
self
.
client
.
post
(
'
/lists/new
'
,
data
=
{
'
item_text
'
:
'
A new list item
'
})
self
.
assertEqual
(
Item
.
objects
.
count
(),
1
)
new_item
=
Item
.
objects
.
first
()
new_list
=
List
.
objects
.
first
()
delete_todo
(
self
,
new_list
.
id
,
new_item
.
id
)
self
.
assertEqual
(
Item
.
objects
.
count
(),
0
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment