class TestChangesController(TestCase): def __init__(self, methodName): """ Class constructor. Starts a Changes class for use in other tests. """ TestCase.__init__(self, methodName) self.changes = Changes( filename='debexpo/tests/changes/synce-hal_0.1-1_source.changes') def testInitialize(self): """ Tests whether the two ways of creating a Changes object output the same result. """ f = open('debexpo/tests/changes/synce-hal_0.1-1_source.changes') contents = f.read() f.close() a = Changes( filename='debexpo/tests/changes/synce-hal_0.1-1_source.changes') b = Changes(string=contents) self.assertEqual(a['Source'], b['Source']) def testGetitem(self): """ Tests Changes.__getitem__. """ self.assertEqual(self.changes['Source'], 'synce-hal') self.assertEqual(self.changes['Urgency'], 'low') def testGetFiles(self): """ Tests Changes.get_files. """ self.assertEqual(self.changes.get_files(), [ 'synce-hal_0.1-1.dsc', 'synce-hal_0.1.orig.tar.gz', 'synce-hal_0.1-1.diff.gz' ]) def testGetComponent(self): """ Tests Changes.get_component(). """ self.assertEqual(self.changes.get_component(), 'main') def testGetPriority(self): """ Tests Changes.get_priority(). """ self.assertEqual(self.changes.get_priority(), 'optional') def testGetDsc(self): """ Tests Changes.get_dsc(). """ self.assertEqual(self.changes.get_dsc(), 'synce-hal_0.1-1.dsc')
class TestChangesController(TestCase): def __init__(self, methodName): """ Class constructor. Starts a Changes class for use in other tests. """ TestCase.__init__(self, methodName) self.changes = Changes(filename='debexpo/tests/changes/synce-hal_0.1-1_source.changes') def testInitialize(self): """ Tests whether the two ways of creating a Changes object output the same result. """ f = open('debexpo/tests/changes/synce-hal_0.1-1_source.changes') contents = f.read() f.close() a = Changes(filename='debexpo/tests/changes/synce-hal_0.1-1_source.changes') b = Changes(string=contents) self.assertEqual(a['Source'], b['Source']) def testGetitem(self): """ Tests Changes.__getitem__. """ self.assertEqual(self.changes['Source'], 'synce-hal') self.assertEqual(self.changes['Urgency'], 'low') def testGetFiles(self): """ Tests Changes.get_files. """ self.assertEqual(self.changes.get_files(), ['synce-hal_0.1-1.dsc', 'synce-hal_0.1.orig.tar.gz', 'synce-hal_0.1-1.diff.gz']) def testGetComponent(self): """ Tests Changes.get_component(). """ self.assertEqual(self.changes.get_component(), 'main') def testGetPriority(self): """ Tests Changes.get_priority(). """ self.assertEqual(self.changes.get_priority(), 'optional') def testGetDsc(self): """ Tests Changes.get_dsc(). """ self.assertEqual(self.changes.get_dsc(), 'synce-hal_0.1-1.dsc')