forked from autokey/autokey
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigurationmanagertest.py
50 lines (37 loc) · 1.64 KB
/
configurationmanagertest.py
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
49
50
import unittest
import lib.configurationmanager as conf
from lib.phrase import *
CONFIG_FILE = "../../config/abbr.ini"
class LegacyImporterTest(unittest.TestCase):
def setUp(self):
self.importer = conf.LegacyImporter()
self.importer.load_config(CONFIG_FILE)
def testGlobalSettings(self):
# Test old global defaults using a phrase that has no custom options defined
# Locate otoh phrase
otohPhrase = None
for phrase in self.importer.phrases:
if phrase.abbreviation == "otoh":
otohPhrase = phrase
break
self.assert_(otohPhrase is not None)
self.assertEqual(otohPhrase.immediate, False)
self.assertEqual(otohPhrase.ignoreCase, False)
self.assertEqual(otohPhrase.matchCase, False)
self.assertEqual(otohPhrase.backspace, True)
self.assertEqual(otohPhrase.omitTrigger, False)
self.assertEqual(otohPhrase.triggerInside, False)
def testPhraseCount(self):
self.assertEqual(len(self.importer.phrases), 23)
def testPhrase(self):
# Locate brb phrase
brbPhrase = None
for phrase in self.importer.phrases:
if phrase.abbreviation == "brb":
brbPhrase = phrase
break
self.assert_(brbPhrase is not None)
self.assertEqual(brbPhrase.phrase, "be right back")
self.assertEqual(brbPhrase.description, "be right back")
self.assertEqual(brbPhrase.mode, PhraseMode.ABBREVIATION)
self.assertEqual(brbPhrase.immediate, True)