def get_list_id(self, board_name, list_name): board_config = self.boards()[board_name] try: if board_config[list_name] is None: return self.find_list_id(board_config, board_name, list_name) return self.boards()[board_name][list_name]["id"] except KeyError: CONFIG.get_config(['TRELLO', 'boards', board_name, list_name]) return self.get_list_id(board_name, list_name)
def get_board_id(self, board_name): try: if self.boards()[board_name]['id'] is None: return self.find_board_id(board_name) return self.boards()[board_name]['id'] except (KeyError, exceptions.ResourceUnavailable) as e: logging.warning("Exception %s at get_board_id", e) CONFIG.get_config(['TRELLO', 'boards', board_name, 'id']) return self.get_board_id(board_name)
def boards(self): return CONFIG.get_config(['TRELLO', 'boards']) or dict()
def test_write_config_saved_to_disc(self): CONFIG.write_config(["CALENDAR", "user"], "flamingo") CONFIG.load_config(self.conf_file) value = CONFIG.get_config(["CALENDAR", "user"]) self.assertEqual(value, "flamingo")
def test_write_config_running_multi_inexistant_field(self): CONFIG.write_config(["CALENDAR", "box", "colour", "id"], "5") value = CONFIG.get_config(["CALENDAR", "box", "colour", "id"]) self.assertEqual(value, "5")
def test_write_config_running_single_inexistant_field(self): CONFIG.write_config(["CALENDAR", "colour"], "pink") value = CONFIG.get_config(["CALENDAR", "colour"]) self.assertEqual(value, "pink")
def test_write_config_running(self): CONFIG.write_config(["CALENDAR", "user"], "flamingo") value = CONFIG.get_config(["CALENDAR", "user"]) self.assertEqual(value, "flamingo")
def test_trello_config(self): value = CONFIG.get_config(["TRELLO", "boards", "default", "id"]) self.assertEqual(value, "5bd9b0bbf266e64d059403fa")
def test_load_correct_config(self): value = CONFIG.get_config(["CALENDAR", "user"]) self.assertEqual(value, "test")