def update_trello_project_board(self): """Update the project cards for projects in ongoing runs """ skip_list_ids = [self.trello.get_list_id(self.trello_board,COMPLETED), self.trello.get_list_id(self.trello_board,ABORTED)] from hugin.project_monitor import ProjectMonitor pm = ProjectMonitor(self.config) runs = self.list_runs() for run in runs: # check if the run has already been archived and if so, skip it if self.trello_board_archive and self.trello.get_card_on_board(self.trello_board_archive,run['name']): print("run {} is archived, skipping".format(run['name'])) continue # check if the run is in a list that should be skipped card = self.trello.get_card_on_board(self.trello_board,run['name']) if card and card.list_id in skip_list_ids: print("run {} is in list {}, skipping".format(run['name'],card.list_id)) continue projects = self.get_run_projects(run) for project in projects: print("Adding run {} to project {}".format(run['name'],project)) pm.add_run_to_project(project,run)
def test_add_project_card(self): """Add a project card to project board""" pm = ProjectMonitor(self.config) project = "J.Doe_11_01" card = pm.add_project_card(project) card.fetch() self.assertIs(type(card), trello.Card, "Did not get a Card object back") self.assertFalse(card.closed, "The added card is closed") lst = pm.trello.get_list(pm.trello_board, "Sequencing") self.assertEqual(card.list_id, lst.id, "Card was not added to the expected list") run = {'name': "Test run 001"} pm.add_run_to_project(project, run) run = {'name': "Test run 002"} pm.add_run_to_project(project, run)