sogo/Tests/Integration/test-preferences.py
Jean Raby 3a4a518c9e Cosmetic fixes in preferences.py
add a new test to set/get text preferences with chars that must be escaped.

Monotone-Parent: 361f4d1d571053d2b3dd474a5d6755ef20cc2851
Monotone-Revision: 72203acde8ebf2eb487bf2f4d7ee94f9c8fcd81a

Monotone-Author: jraby@inverse.ca
Monotone-Date: 2012-02-16T22:03:36
Monotone-Branch: ca.inverse.sogo
2012-02-16 22:03:36 +00:00

43 lines
1.2 KiB
Python

#!/usr/bin/python
from config import hostname, port, username, password
import preferences
import simplejson
import sogotests
import unittest
import utilities
class preferencesTest(unittest.TestCase):
def _setTextPref(self, prefText = None ):
""" set a text preference to a known value """
self.prefs.set("autoReplyText", prefText)
# make sure it was set correctly
prefData = self.prefs.get("Vacation")
try:
self.assertEqual(prefData["autoReplyText"], prefText,
"%s != %s" % (prefData["autoReplyText"], prefText))
except TypeError as err:
self.fail("Preferences are probably hosed: %s" % (err))
def setUp(self):
self.prefs = preferences.preferences()
def tearDown(self):
self.prefs.set("autoReplyText", "")
def testSetTextPreferences(self):
""" Set/get a text preference - normal characters"""
self._setTextPref("defaultText")
def testSetTextPreferencesWeirdChars(self):
""" Set/get a text preference - weird characters - used to crash on 1.3.12"""
prefText = "weird data \ ' \"; ^"
self._setTextPref(prefText)
if __name__ == "__main__":
sogotests.runTests()