~ubuntu-branches/ubuntu/utopic/gozerbot/utopic

« back to all changes in this revision

Viewing changes to plugtests/test_persistconfig.py

  • Committer: Bazaar Package Importer
  • Author(s): Jeremy Malcolm
  • Date: 2009-09-14 09:00:29 UTC
  • mfrom: (1.1.4 upstream) (3.1.5 sid)
  • Revision ID: james.westby@ubuntu.com-20090914090029-uval0ekt72kmklxw
Tags: 0.9.1.3-3
Changed dependency on python-setuptools to python-pkg-resources
(Closes: #546435) 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# tests/test_persistconfig.py
2
 
#
3
 
#
4
 
 
5
 
__copyright__ = 'this file is in the public domain'
6
 
 
7
 
from gozerbot.generic import stringinlist, waitforqueue
8
 
from gozerbot.persistconfig import PersistConfig
9
 
from gozerbot.plugins import plugins
10
 
import unittest
11
 
 
12
 
cfg = PersistConfig()
13
 
 
14
 
class test_persistconfig(unittest.TestCase):
15
 
    
16
 
    def test_persistconfig(self):
17
 
        cfg.define('stringtest', "mekker")
18
 
        cfg.set("stringtest", 'bla')
19
 
        a = cfg.get("stringtest")
20
 
        self.assertEqual(a, "bla")
21
 
 
22
 
    def test_persistconfig2(self):
23
 
        cfg.define('stringtest', "mekker")
24
 
        cfg.set("stringtest", 'bla')
25
 
        a = cfg.get("stringtest")
26
 
        a = 'miep'
27
 
        b = cfg.get("stringtest")
28
 
        self.assertEqual(b, "bla")
29
 
 
30
 
    def test_persistconfig3(self):
31
 
        cfg.define('stringtest2', "")
32
 
        cfg.set("stringtest2", 'bla')
33
 
        a = cfg.get("stringtest2")
34
 
        self.assertEqual(a, "bla")
35
 
 
36
 
    def test_persistconfig4(self):
37
 
        cfg.define('stringtest3', "")
38
 
        cfg.set("stringtest3", 'bla')
39
 
        plugins.reload('plugtests', 'test_persistconfig')
40
 
        a = cfg.get("stringtest3")
41
 
        self.assertEqual(a, "bla")
42
 
 
43
 
    def test_persistconfig3(self):
44
 
        cfg.define('stringtest4', "")
45
 
        cfg.set("stringtest4", u'bla')
46
 
        a = cfg.get("stringtest4")
47
 
        self.assertEqual(a, "bla")