def test_init(self): ctf_settings = settings("ctf") self.assertEqual(ctf_settings.config_file_name, "conf.json") self.assertEqual(ctf_settings.root_path, "~/") self.assertEqual(ctf_settings.category_path, "~/ctf/") audit_settings = settings("audit") self.assertEqual(audit_settings.config_file_name, "conf.json") self.assertEqual(audit_settings.root_path, "~/") self.assertEqual(audit_settings.category_path, "~/audit/")
def load(self): ''' Load shows, setup the basics ''' label = QLabel() self.ui.statusbar.addWidget(label) try: label.setText('Loading settings') self.settings = settings() if self.settings.get(settings.categories.application, settings.keys.firstrun, bool): self.ui.tabs.setCurrentIndex(4) self.settings.set(settings.categories.application, settings.keys.firstrun, False) lastupdated = self.settings.get(settings.categories.application, settings.keys.lastupdated, datetime) self.setlastupdatedstatus(lastupdated) self.ui.settingsautoswitchshowtab.setChecked(self.settings.get(settings.categories.application, settings.keys.autoswitchshowtab, bool)) self.ui.settingsautoswitchseasontab.setChecked(self.settings.get(settings.categories.application, settings.keys.autoswitchseasontab, bool)) label.setText('Loading storage') self.storage = storage(self.settings.path()) label.setText('Loading backend') self.backend = thetvdbbackend(self.settings) label.setText('Displaying shows') self.displayshows() self.displayshowstatuses() except RuntimeError as (errnum, errstr): print 'An error has occurred (%d: %s)' % (errnum, errstr)
def __init__(self, name): self.name = name self.date = datetime.datetime.now().year self.settings = settings.settings(category="ctf") with open("conf.json") as config_file : self.conf = json.load(config_file)["ctf_conf"]
def setUp(self): self.obj = settings()