File: _test_absolute.py

package info (click to toggle)
python-caldav 1.3.9-1.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 636 kB
  • sloc: python: 6,824; makefile: 91; sh: 7
file content (47 lines) | stat: -rw-r--r-- 1,290 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# encoding: utf-8
import datetime

import caldav


class TestRadicale(object):

    SUMMARIES = set(
        (
            "Godspeed You! Black Emperor at " "Cirque Royal / Koninklijk Circus",
            "Standard - GBA",
        )
    )
    DTSTART = set(
        (datetime.datetime(2011, 3, 4, 20, 0), datetime.datetime(2011, 1, 15, 20, 0))
    )

    def setup(self):
        URL = "http://localhost:8080/nicoe/perso/"
        self.client = caldav.DAVClient(URL)
        self.calendar = caldav.objects.Calendar(self.client, URL)

    def test_eventslist(self):
        events = self.calendar.events()
        assert len(events) == 2

        summaries, dtstart = set(), set()
        for event in events:
            event.load()
            vobj = event.instance
            summaries.add(vobj.vevent.summary.value)
            dtstart.add(vobj.vevent.dtstart.value)

        assert summaries == self.SUMMARIES
        assert dtstart == self.DTSTART


class TestTryton(object):
    def setup(self):
        URL = "http://admin:admin@localhost:9080/caldav/Calendars/Test"
        self.client = caldav.DAVClient(URL)
        self.calendar = caldav.objects.Calendar(self.client, URL)

    def test_eventslist(self):
        events = self.calendar.events()
        assert len(events) == 1