Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
topydo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
topydo
Commits
19cca43a
Commit
19cca43a
authored
Feb 22, 2017
by
Jacek Sowiński
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adapt test of `do` and `del` for post_archive()
parent
6c49fbdd
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
79 additions
and
8 deletions
+79
-8
test/test_delete_command.py
test/test_delete_command.py
+21
-0
test/test_do_command.py
test/test_do_command.py
+56
-8
test/test_list_project_command.py
test/test_list_project_command.py
+2
-0
No files found.
test/test_delete_command.py
View file @
19cca43a
...
...
@@ -47,6 +47,7 @@ class DeleteCommandTest(CommandTest):
command
=
DeleteCommand
([
"1"
],
self
.
todolist
,
self
.
out
,
self
.
error
,
_no_prompt
)
command
.
execute
()
command
.
execute_post_archive_actions
()
self
.
assertTrue
(
self
.
todolist
.
dirty
)
self
.
assertEqual
(
self
.
todolist
.
todo
(
1
).
source
(),
"Bar"
)
...
...
@@ -57,6 +58,7 @@ class DeleteCommandTest(CommandTest):
command
=
DeleteCommand
([
"Foo"
],
self
.
todolist
,
self
.
out
,
self
.
error
,
_no_prompt
)
command
.
execute
()
command
.
execute_post_archive_actions
()
self
.
assertTrue
(
self
.
todolist
.
dirty
)
self
.
assertEqual
(
self
.
todolist
.
todo
(
1
).
source
(),
"Bar"
)
...
...
@@ -67,6 +69,7 @@ class DeleteCommandTest(CommandTest):
command
=
DeleteCommand
([
"1"
],
self
.
todolist
,
self
.
out
,
self
.
error
,
_yes_prompt
)
command
.
execute
()
command
.
execute_post_archive_actions
()
self
.
assertTrue
(
self
.
todolist
.
dirty
)
self
.
assertEqual
(
self
.
todolist
.
count
(),
2
)
...
...
@@ -78,6 +81,7 @@ class DeleteCommandTest(CommandTest):
command
=
DeleteCommand
([
"-f"
,
"1"
],
self
.
todolist
,
self
.
out
,
self
.
error
,
_yes_prompt
)
command
.
execute
()
command
.
execute_post_archive_actions
()
self
.
assertTrue
(
self
.
todolist
.
dirty
)
self
.
assertEqual
(
self
.
todolist
.
count
(),
3
)
# force won't delete subtasks
...
...
@@ -88,6 +92,7 @@ class DeleteCommandTest(CommandTest):
command
=
DeleteCommand
([
"--force"
,
"1"
],
self
.
todolist
,
self
.
out
,
self
.
error
,
_yes_prompt
)
command
.
execute
()
command
.
execute_post_archive_actions
()
self
.
assertTrue
(
self
.
todolist
.
dirty
)
self
.
assertEqual
(
self
.
todolist
.
count
(),
3
)
# force won't delete subtasks
...
...
@@ -97,6 +102,7 @@ class DeleteCommandTest(CommandTest):
def
test_del5
(
self
):
command
=
DeleteCommand
([
"2"
],
self
.
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
command
.
execute_post_archive_actions
()
self
.
assertTrue
(
self
.
todolist
.
dirty
)
self
.
assertEqual
(
self
.
todolist
.
todo
(
1
).
source
(),
"Foo"
)
...
...
@@ -106,6 +112,7 @@ class DeleteCommandTest(CommandTest):
def
test_del7
(
self
):
command
=
DeleteCommand
([
"99"
],
self
.
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
command
.
execute_post_archive_actions
()
self
.
assertFalse
(
self
.
todolist
.
dirty
)
self
.
assertEqual
(
self
.
output
,
""
)
...
...
@@ -114,6 +121,7 @@ class DeleteCommandTest(CommandTest):
def
test_del8
(
self
):
command
=
DeleteCommand
([
"A"
],
self
.
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
command
.
execute_post_archive_actions
()
self
.
assertFalse
(
self
.
todolist
.
dirty
)
self
.
assertEqual
(
self
.
output
,
""
)
...
...
@@ -125,6 +133,7 @@ class DeleteCommandTest(CommandTest):
command
=
DeleteCommand
([
"8to"
],
self
.
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
command
.
execute_post_archive_actions
()
result
=
"Foo
\
n
a @test with due:2015-06-03
\
n
a @test with +project"
...
...
@@ -136,6 +145,7 @@ class DeleteCommandTest(CommandTest):
command
=
DeleteCommand
([
"1"
,
"2"
],
self
.
todolist
,
self
.
out
,
self
.
error
,
_no_prompt
)
command
.
execute
()
command
.
execute_post_archive_actions
()
result
=
"a @test with due:2015-06-03
\
n
a @test with +project"
...
...
@@ -147,6 +157,7 @@ class DeleteCommandTest(CommandTest):
command
=
DeleteCommand
([
"1"
,
"2"
],
self
.
todolist
,
self
.
out
,
self
.
error
,
_yes_prompt
)
command
.
execute
()
command
.
execute_post_archive_actions
()
result
=
"a @test with due:2015-06-03
\
n
a @test with +project"
...
...
@@ -158,6 +169,7 @@ class DeleteCommandTest(CommandTest):
command
=
DeleteCommand
([
"99"
,
"2"
],
self
.
todolist
,
self
.
out
,
self
.
error
,
_yes_prompt
)
command
.
execute
()
command
.
execute_post_archive_actions
()
self
.
assertFalse
(
self
.
todolist
.
dirty
)
self
.
assertEqual
(
self
.
output
,
""
)
...
...
@@ -168,6 +180,7 @@ class DeleteCommandTest(CommandTest):
command
=
DeleteCommand
([
"99"
,
"A"
],
self
.
todolist
,
self
.
out
,
self
.
error
,
_yes_prompt
)
command
.
execute
()
command
.
execute_post_archive_actions
()
self
.
assertFalse
(
self
.
todolist
.
dirty
)
self
.
assertEqual
(
self
.
output
,
""
)
...
...
@@ -180,6 +193,7 @@ class DeleteCommandTest(CommandTest):
command
=
DeleteCommand
([
u"Fo
\
u00d3
B
\
u0105
r"
,
"Bar"
],
self
.
todolist
,
self
.
out
,
self
.
error
,
None
)
command
.
execute
()
command
.
execute_post_archive_actions
()
self
.
assertFalse
(
self
.
todolist
.
dirty
)
self
.
assertEqual
(
self
.
output
,
""
)
...
...
@@ -190,6 +204,7 @@ class DeleteCommandTest(CommandTest):
command
=
DeleteCommand
([
"-e"
,
"@test"
],
self
.
todolist
,
self
.
out
,
self
.
error
,
None
)
command
.
execute
()
command
.
execute_post_archive_actions
()
result
=
"Removed: a @test with due:2015-06-03
\
n
Removed: a @test with +project
\
n
"
...
...
@@ -202,6 +217,7 @@ class DeleteCommandTest(CommandTest):
command
=
DeleteCommand
([
"-e"
,
"@test"
,
"due:2015-06-03"
],
self
.
todolist
,
self
.
out
,
self
.
error
,
None
)
command
.
execute
()
command
.
execute_post_archive_actions
()
self
.
assertTrue
(
self
.
todolist
.
dirty
)
self
.
assertEqual
(
self
.
output
,
"Removed: a @test with due:2015-06-03
\
n
"
)
...
...
@@ -211,6 +227,7 @@ class DeleteCommandTest(CommandTest):
command
=
DeleteCommand
([
"-e"
,
"@test"
,
"due:2015-06-03"
,
"+project"
],
self
.
todolist
,
self
.
out
,
self
.
error
,
None
)
command
.
execute
()
command
.
execute_post_archive_actions
()
self
.
assertFalse
(
self
.
todolist
.
dirty
)
...
...
@@ -219,6 +236,7 @@ class DeleteCommandTest(CommandTest):
command
=
DeleteCommand
([
"-e"
,
""
],
self
.
todolist
,
self
.
out
,
self
.
error
,
None
)
command
.
execute
()
command
.
execute_post_archive_actions
()
result
=
"Foo"
...
...
@@ -231,6 +249,7 @@ class DeleteCommandTest(CommandTest):
command
=
DeleteCommand
([
"-xe"
,
""
],
self
.
todolist
,
self
.
out
,
self
.
error
,
_yes_prompt
)
command
.
execute
()
command
.
execute_post_archive_actions
()
self
.
assertTrue
(
self
.
todolist
.
dirty
)
self
.
assertEqual
(
self
.
todolist
.
count
(),
0
)
...
...
@@ -238,6 +257,7 @@ class DeleteCommandTest(CommandTest):
def
test_empty
(
self
):
command
=
DeleteCommand
([],
self
.
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
command
.
execute_post_archive_actions
()
self
.
assertFalse
(
self
.
todolist
.
dirty
)
self
.
assertFalse
(
self
.
output
)
...
...
@@ -251,6 +271,7 @@ class DeleteCommandTest(CommandTest):
def
test_help
(
self
):
command
=
DeleteCommand
([
"help"
],
self
.
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
command
.
execute_post_archive_actions
()
self
.
assertEqual
(
self
.
output
,
""
)
self
.
assertEqual
(
self
.
errors
,
...
...
test/test_do_command.py
View file @
19cca43a
This diff is collapsed.
Click to expand it.
test/test_list_project_command.py
View file @
19cca43a
...
...
@@ -26,6 +26,7 @@ class ListProjectCommandTest(CommandTest):
todolist
=
load_file_to_todolist
(
"test/data/TodoListTest.txt"
)
command
=
ListProjectCommand
([
""
],
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
command
.
execute_post_archive_actions
()
# test default implementation of post_archive
self
.
assertEqual
(
self
.
output
,
"Project1
\
n
Project2
\
n
"
)
self
.
assertFalse
(
self
.
errors
)
...
...
@@ -34,6 +35,7 @@ class ListProjectCommandTest(CommandTest):
todolist
=
load_file_to_todolist
(
"test/data/TodoListTest.txt"
)
command
=
ListProjectCommand
([
"aaa"
],
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
command
.
execute_post_archive_actions
()
self
.
assertEqual
(
self
.
output
,
"Project1
\
n
Project2
\
n
"
)
self
.
assertFalse
(
self
.
errors
)
...
...
Write
Preview
Markdown
is supported
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