class TestDiskConnector(TestCase): def setUp(self): cq = ConsoleQuery(False) self._dc = DiskConnector(cq) def test_disks_names(self): print self._dc.disks_names() self.assertGreater(self._dc.disks_names(), 0, "Impossible! You have disks have no names:)") def test_disks_count(self): self.assertGreater(self._dc.disks_count(), 0, "Impossible! You have no disks:)") def test_disk_details(self): print self._dc.disk_details(1) result = self._dc.disk_details(1) self.assertTrue(result, '(\(\'name:)(.*)')
class DiskApp(object): def __init__(self): query = ConsoleQuery(False) self.__disk_connector = DiskConnector(query) def disks_count(self): return self.__disk_connector.disks_count() def disks_names(self): print self.__disk_connector.disks_names() def print_data_about_all_disks(self): for i in range(0, self.__disk_connector.disks_count()): print self.__disk_connector.disk_details(i) def information_level_verbose(self): query = ConsoleQuery(True) self.__disk_connector = DiskConnector(query) def information_level_info(self): query = ConsoleQuery(False) self.__disk_connector = DiskConnector(query)