Example #1
0
    def test_export_one_task(self):
        the_xml = """<xml>
<item>
<title>t1</title>
<priority>Top</priority>
<startdate>2011-02-01</startdate>
<duedate>2011-03-28</duedate>
<context>C2</context>
<note>Django
Python</note>
<repeat>Every 1 week</repeat>
<repeat_from_due_date>Yes</repeat_from_due_date>
</item>
</xml>"""
        c = self.new_context(title = 'C2')
        t = self.new_task(
            description = 't1',
            priority = 3,
            start_date = datetime.date(2011,2,1),
            due_date = datetime.date(2011,3,28),
            context = c,
            note = 'Django\nPython',
            repeat_nb = 1,
            repeat_type = 'W',
            repeat_from_due_date = True
        )
        s = create_xml_from_tasks([t])
        self.assertEqual(the_xml, s)
Example #2
0
    def test_export_not_much_info(self):
        the_xml = """<xml>
<item>
<title>t1</title>
</item>
</xml>"""
        t = self.new_task(
            description = 't1',
        )
        s = create_xml_from_tasks([t])
        self.assertEqual(the_xml, s)
Example #3
0
    def test_export_done(self):
        the_xml = """<xml>
<item>
<title>t1</title>
<completed>1111-11-11</completed>
</item>
</xml>"""
        t = self.new_task(
            description = 't1',
            done = True
        )
        s = create_xml_from_tasks([t])
        self.assertEqual(the_xml, s)
Example #4
0
    def test_export_repeat_year(self):
        the_xml = """<xml>
<item>
<title>t1</title>
<repeat>Every 1 year</repeat>
</item>
</xml>"""
        t = self.new_task(
            description = 't1',
            repeat_nb = 1,
            repeat_type = 'Y'
        )
        s = create_xml_from_tasks([t])
        self.assertEqual(the_xml, s)
Example #5
0
    def test_xml_round_trip(self):
        the_xml = """<xml>
<item>
<title>Change password</title>
<priority>Top</priority>
<startdate>2011-02-01</startdate>
<duedate>2011-03-28</duedate>
<context>C2</context>
<note>Django
Python</note>
</item>
</xml>"""
        out = create_xml_from_tasks(self.create_tasks_from_xml(the_xml))
        self.assertEqual(the_xml, out)
Example #6
0
    def test_export_empty(self):
        the_xml = """<xml>
</xml>"""
        s = create_xml_from_tasks([])
        self.assertEqual(the_xml, s)
Example #7
0
File: views.py Project: nodet/yata
def xml_export(request):
    the_xml = create_xml_from_tasks(Task.objects.for_user(request.user))
    response = HttpResponse(the_xml, mimetype="text/xml")
    response['Content-Disposition'] = 'attachment; filename=yata.xml'
    return response