File: edataserver

package info (click to toggle)
evolution-data-server 3.22.7-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 62,116 kB
  • ctags: 41,630
  • sloc: ansic: 302,318; makefile: 4,890; sh: 4,182; cpp: 472; xml: 462; perl: 368; python: 71
file content (48 lines) | stat: -rw-r--r-- 1,696 bytes parent folder | download | duplicates (4)
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
48
#!/usr/bin/env python3

import unittest
import subprocess
import sys
import os

import gi
gi.require_version('EDataServer', '1.2')
from gi.repository import EDataServer

class TestEDataServer(unittest.TestCase):

  registry = ()

  @classmethod
  def setUpClass(self):
    self.registry = EDataServer.SourceRegistry.new_sync(None)

  def testSourceRegistryIsValid(self):
    self.assertIsInstance(self.registry, EDataServer.SourceRegistry)

  def testSourceRegistryHasSources(self):
    sources = self.registry.list_sources(None)
    self.assertIsInstance(sources[0], EDataServer.Source)
    print()
    print("Found a source: " + sources[0].get_display_name())

  def testSourceRegistryBuiltinMailAccountExists(self):
    mail_account = self.registry.ref_builtin_mail_account()
    self.assertIsInstance(mail_account, EDataServer.Source)
    self.assertTrue(mail_account.has_extension(EDataServer.SOURCE_EXTENSION_MAIL_ACCOUNT))
    self.assertIn('local', mail_account.get_uid())

  def testSourceRegistryBuiltinCalendarExists(self):
    calendar = self.registry.ref_builtin_calendar()
    self.assertIsInstance(calendar, EDataServer.Source)
    self.assertTrue(calendar.has_extension(EDataServer.SOURCE_EXTENSION_CALENDAR))
    self.assertIn('system-calendar', calendar.get_uid())

  def testSourceRegistryBuiltinAddressBookExists(self):
    addressbook = self.registry.ref_builtin_address_book()
    self.assertIsInstance(addressbook, EDataServer.Source)
    self.assertTrue(addressbook.has_extension(EDataServer.SOURCE_EXTENSION_ADDRESS_BOOK))
    self.assertIn('system-address-book', addressbook.get_uid())

unittest.main(testRunner=unittest.TextTestRunner(stream=sys.stdout, verbosity=2))