sogo/Tests/Integration/test-preferences.py
Jean Raby 6ef5d5bccc remove 'except as' since it is not supported on python 2.5 (debian-lenny)
Monotone-Parent: 04bea15431a5d37d2c52ccda4a30d78b57741793
Monotone-Revision: e27ba437a27fa40967d6195b9f420b3c36988d81

Monotone-Author: jraby@inverse.ca
Monotone-Date: 2012-02-17T22:06:58
Monotone-Branch: ca.inverse.sogo
2012-02-17 22:06:58 +00:00

40 lines
1.1 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")
self.assertEqual(prefData["autoReplyText"], prefText,
"%s != %s" % (prefData["autoReplyText"], prefText))
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()