Commit bc08f745 authored by Bram Schoenmakers's avatar Bram Schoenmakers

Add tests for the dot output

parent 985f9b6d
(C) 2015-11-05 Foo @Context2 Not@Context +Project1 Not+Project due:2016-11-18 t:2016-11-17
(D) Bar @Context1 +Project2 p:1
(C) Baz @Context1 +Project1 key:value id:1
(C) Drink beer @ home
(C) 13 + 29 = 42
x 2014-12-12 Completed but with date:2014-12-12
digraph topydo {
node [ shape="none" margin="0" fontsize="9" fontname="Helvetica" ]
_1 [label=<<TABLE CELLBORDER="0" CELLSPACING="1" VALIGN="top"><TR><TD><B>1</B></TD><TD BALIGN="LEFT"><B>Foo @Context2 Not@Context +Project1<BR />Not+Project</B></TD></TR><HR/><TR><TD ALIGN="RIGHT">Prio:</TD><TD ALIGN="LEFT">C</TD></TR><TR><TD ALIGN="RIGHT">Starts:</TD><TD ALIGN="LEFT">2016-11-17 (today)</TD></TR><TR><TD ALIGN="RIGHT">Due:</TD><TD ALIGN="LEFT">2016-11-18 (in a day)</TD></TR></TABLE>> style=filled fillcolor="#008000" fontcolor="#ffffff"]
_3 [label=<<TABLE CELLBORDER="0" CELLSPACING="1" VALIGN="top"><TR><TD><B>3</B></TD><TD BALIGN="LEFT"><B>Baz @Context1 +Project1</B></TD></TR><HR/><TR><TD ALIGN="RIGHT">Prio:</TD><TD ALIGN="LEFT">C</TD></TR></TABLE>> style=filled fillcolor="#008000" fontcolor="#ffffff"]
_4 [label=<<TABLE CELLBORDER="0" CELLSPACING="1" VALIGN="top"><TR><TD><B>4</B></TD><TD BALIGN="LEFT"><B>Drink beer @ home</B></TD></TR><HR/><TR><TD ALIGN="RIGHT">Prio:</TD><TD ALIGN="LEFT">C</TD></TR></TABLE>> style=filled fillcolor="#008000" fontcolor="#ffffff"]
_5 [label=<<TABLE CELLBORDER="0" CELLSPACING="1" VALIGN="top"><TR><TD><B>5</B></TD><TD BALIGN="LEFT"><B>13 + 29 = 42</B></TD></TR><HR/><TR><TD ALIGN="RIGHT">Prio:</TD><TD ALIGN="LEFT">C</TD></TR></TABLE>> style=filled fillcolor="#008000" fontcolor="#ffffff"]
_2 [label=<<TABLE CELLBORDER="0" CELLSPACING="1" VALIGN="top"><TR><TD><B>2</B></TD><TD BALIGN="LEFT"><B>Bar @Context1 +Project2</B></TD></TR><HR/><TR><TD ALIGN="RIGHT">Prio:</TD><TD ALIGN="LEFT">D</TD></TR></TABLE>> style=filled fillcolor="#008000" fontcolor="#ffffff"]
_6 [label=<<TABLE CELLBORDER="0" CELLSPACING="1" VALIGN="top"><TR><TD><B>6</B></TD><TD BALIGN="LEFT"><B><S>Completed but with</S></B></TD></TR></TABLE>> style=filled fillcolor="#008000" fontcolor="#ffffff"]
_3 -> _2
_1 -> _4 [style="invis"]
_4 -> _5 [style="invis"]
_5 -> _6 [style="invis"]
}
......@@ -18,6 +18,7 @@ import codecs
import re
import unittest
from collections import namedtuple
from freezegun import freeze_time
from test.command_testcase import CommandTest
from test.facilities import load_file_to_todolist
......@@ -494,5 +495,29 @@ class ListCommandIcalTest(CommandTest):
replace_ical_tags(icaltext))
self.assertEqual(self.errors, "")
@freeze_time('2016, 11, 17')
class ListCommandDotTest(CommandTest):
def setUp(self):
self.maxDiff = None
def test_dot(self):
todolist = load_file_to_todolist("test/data/ListCommandDotTest.txt")
command = ListCommand(["-x", "-f", "dot"], todolist, self.out,
self.error)
command.execute()
self.assertFalse(todolist.dirty)
dottext = ""
with codecs.open('test/data/ListCommandTest.dot', 'r',
encoding='utf-8') as dot:
dottext = dot.read()
self.assertEqual(self.output, dottext)
self.assertEqual(self.errors, "")
if __name__ == '__main__':
unittest.main()
......@@ -36,10 +36,6 @@ class DotPrinter(Printer):
self.todolist = p_todolist
def print_list(self, p_todos):
def escape(p_text):
""" Escapes double quotes as they are special in attributes. """
return p_text.replace('"', '\\"')
def node_label(p_todo):
"""
Prints an HTML table for a node label with some todo details.
......
Markdown is supported
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