def test_annotations_with_link(self): self.config.set('general', 'annotation_links', 'true') service = TrelloService(self.config, 'general', 'mytrello') annotations = service.annotations(self.CARD1) self.assertEqual(list(annotations), [ "https://trello.com/c/AAaaBBbb", "@luidgi - Preums", "@mario - Deuz" ])
def test_annotations_with_link(self): self.config.set('general', 'annotation_links', 'true') service = TrelloService(self.config, 'general', 'mytrello') annotations = service.annotations(self.CARD1) self.assertEqual( list(annotations), ["https://trello.com/c/AAaaBBbb", "@luidgi - Preums", "@mario - Deuz"])
def test_get_boards_config(self): self.config.set('mytrello', 'trello.include_boards', 'F00, B4R') service = TrelloService(self.config, 'general', 'mytrello') boards = service.get_boards() self.assertEqual(list(boards), [{ 'id': 'F00', 'name': 'Foo Board' }, { 'id': 'B4R', 'name': 'Bar Board' }])
def test_issues(self): self.config.set('mytrello', 'trello.include_lists', 'List 1') self.config.set('mytrello', 'trello.only_if_assigned', 'tintin') service = TrelloService(self.config, 'general', 'mytrello') issues = service.issues() expected = { 'description': u'(bw)#1 - Card 1 .. https://trello.com/c/AAaaBBbb', 'priority': 'M', 'project': 'My Board', 'trelloboard': 'My Board', 'trellolist': 'List 1', 'trellocard': 'Card 1', 'trellocardid': 'C4RD', 'trelloshortlink': 'abcd', 'trelloshorturl': 'https://trello.com/c/AAaaBBbb', 'trellourl': 'https://trello.com/c/AAaBBbb/42-so-long', 'annotations': [ "@luidgi - Preums", "@mario - Deuz" ], 'tags': []} actual = next(issues).get_taskwarrior_record() self.assertEqual(expected, actual)
def test_get_boards_config(self): self.config.set('mytrello', 'trello.include_boards', 'F00, B4R') service = TrelloService(self.config, 'general', 'mytrello') boards = service.get_boards() self.assertEqual(list(boards), [{'id': 'F00', 'name': 'Foo Board'}, {'id': 'B4R', 'name': 'Bar Board'}])
def test_valid_config_no_api_key(self, die): self.config.remove_option('mytrello', 'trello.api_key') TrelloService.validate_config(self.service_config, 'mytrello') die.assert_called_with("[mytrello] has no 'trello.api_key'")
def test_validate_config(self, die): TrelloService.validate_config(self.service_config, 'mytrello') die.assert_not_called()
def test_annotations(self): service = TrelloService(self.config, 'general', 'mytrello') annotations = service.annotations(self.CARD1) self.assertEqual( list(annotations), ["@luidgi - Preums", "@mario - Deuz"])
def test_get_comments(self): service = TrelloService(self.config, 'general', 'mytrello') comments = service.get_comments('C4RD') self.assertEqual(list(comments), [self.COMMENT1, self.COMMENT2])
def test_get_cards_assigned_unassigned(self): self.config.set('mytrello', 'trello.only_if_assigned', 'tintin') self.config.set('mytrello', 'trello.also_unassigned', 'true') service = TrelloService(self.config, 'general', 'mytrello') cards = service.get_cards('L15T') self.assertEqual(list(cards), [self.CARD1, self.CARD3])
def test_get_cards(self): service = TrelloService(self.config, 'general', 'mytrello') cards = service.get_cards('L15T') self.assertEqual(list(cards), [self.CARD1, self.CARD2, self.CARD3])
def test_get_lists_exclude(self): self.config.set('mytrello', 'trello.exclude_lists', 'List 1') service = TrelloService(self.config, 'general', 'mytrello') lists = service.get_lists('B04RD') self.assertEqual(list(lists), [self.LIST2])
def test_get_lists(self): service = TrelloService(self.config, 'general', 'mytrello') lists = service.get_lists('B04RD') self.assertEqual(list(lists), [self.LIST1, self.LIST2])
def test_get_boards_api(self): service = TrelloService(self.config, 'general', 'mytrello') boards = service.get_boards() self.assertEqual(list(boards), [self.BOARD])