File: save.py

package info (click to toggle)
python-gpyconf 0.2-1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd, stretch
  • size: 416 kB
  • ctags: 590
  • sloc: python: 1,980; makefile: 87; sh: 4
file content (25 lines) | stat: -rw-r--r-- 613 bytes parent folder | download
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
# Tests wether saving and reading configuration works correctly.
import unittest

class StorageTestCase(unittest.TestCase):
    def setUp(self):
        from all_fields import AllFieldsTest
        self._class = AllFieldsTest
        self.options = {}

    def runTest(self):
        ins = self._class()
        for var, field in ins.fields.iteritems():
            self.options[var] = field.value

        ins.save()
        del ins

        ins = self._class()

        for var in self.options:
            self.assertEqual(self.options[var], getattr(ins, var))


if __name__ == '__main__':
    unittest.main()