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
57a6ab53
Commit
57a6ab53
authored
Feb 04, 2015
by
Bram Schoenmakers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test case for IcalCommand.
parent
4875c06a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
0 deletions
+58
-0
test/IcalCommandTest.py
test/IcalCommandTest.py
+58
-0
test/data/ListCommandTest.ics
test/data/ListCommandTest.ics
+0
-0
No files found.
test/IcalCommandTest.py
0 → 100644
View file @
57a6ab53
# Topydo - A todo.txt client written in Python.
# Copyright (C) 2015 Bram Schoenmakers <me@bramschoenmakers.nl>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import
re
import
unittest
from
topydo.lib.Config
import
config
import
CommandTest
from
topydo.lib.IcalCommand
import
IcalCommand
import
TestFacilities
class
IcalCommandTest
(
CommandTest
.
CommandTest
):
def
setUp
(
self
):
super
(
IcalCommandTest
,
self
).
setUp
()
self
.
todolist
=
TestFacilities
.
load_file_to_todolist
(
"test/data/ListCommandTest.txt"
)
def
test_ical
(
self
):
def
replace_ical_tags
(
p_text
):
# replace identifiers with dots, since they're random.
result
=
re
.
sub
(
r'\bical:....\b'
,
'ical:....'
,
p_text
)
result
=
re
.
sub
(
r'\bUID:....\b'
,
'UID:....'
,
result
)
return
result
command
=
IcalCommand
([
""
],
self
.
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
self
.
assertTrue
(
self
.
todolist
.
is_dirty
())
icaltext
=
""
with
open
(
'test/data/ListCommandTest.ics'
,
'r'
)
as
ical
:
icaltext
=
""
.
join
(
ical
.
readlines
())
self
.
assertEquals
(
replace_ical_tags
(
self
.
output
),
replace_ical_tags
(
icaltext
))
self
.
assertEquals
(
self
.
errors
,
""
)
def
test_help
(
self
):
command
=
IcalCommand
([
"help"
],
self
.
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
self
.
assertEquals
(
self
.
output
,
""
)
self
.
assertEquals
(
self
.
errors
,
command
.
usage
()
+
"
\
n
\
n
"
+
command
.
help
()
+
"
\
n
"
)
if
__name__
==
'__main__'
:
unittest
.
main
()
test/data/ListCommandTest.ics
0 → 100644
View file @
57a6ab53
This diff was suppressed by a .gitattributes entry.
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