3 from db_test import DBDakTestCase
5 from daklib.dbconn import Architecture, Suite
12 import simplejson as json
17 class ORMObjectTestCase(DBDakTestCase):
19 The ORMObjectTestCase tests the behaviour of the ORMObject.
22 def test_strings(self):
23 'tests json(), __repr__(), and __str__()'
24 architecture = Architecture(arch_string = 'i386')
26 data = json.loads(architecture.json())
27 self.assertEqual('i386', data['arch_string'])
29 self.assertEqual('<Architecture i386>', repr(architecture))
31 self.assertTrue(re.match('<Architecture {.*}>', str(architecture)))
32 self.assertTrue(re.search('"arch_string": "i386"', str(architecture)))
33 sid = Suite(suite_name = 'sid')
34 squeeze = Suite(suite_name = 'squeeze')
35 architecture.suites = [sid, squeeze]
36 self.assertTrue(re.search('"suites_count": 2', str(architecture)))
38 if __name__ == '__main__':