def refresh_credentials(self): logging.warning("Unauthorized. Client: %s", self.client) print("Time to refresh credentials!") print("Log in to trello at https://trello.com,\ then visit https://trello.com/app-key") self.api_key = input("Trello API key: ") CONFIG.write_config(["TRELLO", "api_key"], self.api_key) self.token = input("Trello token: ") CONFIG.write_config(["TRELLO", "token"], self.token) self.login_petition()
def list_to_yaml(self, board_name, list_name, list_id): CONFIG.write_config( ['TRELLO', 'boards', board_name, list_name, 'id'], list_id)
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 board_to_yaml(self, name, board_id): CONFIG.write_config(['TRELLO', 'boards', name, 'id'], board_id)
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_login__wrong_credentials(self, mock): CONFIG.write_config(['TRELLO', 'token'], "1") self.t_client.login() self.assertTrue(mock.called)
def test_login__no_token(self, mock): CONFIG.write_config(['TRELLO', 'token'], None) self.t_client.login() self.assertTrue(mock.called)