Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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_valid_config_no_access_token(self, die):
self.config.remove_option('mytrello', 'trello.token')
TrelloService.validate_config(self.service_config, 'mytrello')
die.assert_called_with("[mytrello] has no 'trello.token'")
def setUp(self):
super(TestTrelloService, self).setUp()
self.config = configparser.RawConfigParser()
self.config.add_section('general')
self.config.add_section('mytrello')
self.config.set('mytrello', 'trello.api_key', 'XXXX')
self.config.set('mytrello', 'trello.token', 'YYYY')
self.service_config = ServiceConfig(
TrelloService.CONFIG_PREFIX, self.config, 'mytrello')
responses.add(responses.GET,
'https://api.trello.com/1/lists/L15T/cards/open',
json=[self.CARD1, self.CARD2, self.CARD3])
responses.add(responses.GET,
'https://api.trello.com/1/boards/B04RD/lists/open',
json=[self.LIST1, self.LIST2])
responses.add(responses.GET,
'https://api.trello.com/1/boards/F00',
json={'id': 'F00', 'name': 'Foo Board'})
responses.add(responses.GET,
'https://api.trello.com/1/boards/B4R',
json={'id': 'B4R', 'name': 'Bar Board'})
responses.add(responses.GET,
'https://api.trello.com/1/members/me/boards',
json=[self.BOARD])
responses.add(responses.GET,
def test_get_lists_include(self):
self.config.set('mytrello', 'trello.include_lists', 'List 1')
service = TrelloService(self.config, 'general', 'mytrello')
lists = service.get_lists('B04RD')
self.assertEqual(list(lists), [self.LIST1])
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_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_cards_assigned(self):
self.config.set('mytrello', 'trello.only_if_assigned', 'tintin')
service = TrelloService(self.config, 'general', 'mytrello')
cards = service.get_cards('L15T')
self.assertEqual(list(cards), [self.CARD1])
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_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 = {
'due': parse_date('2018-12-02T12:59:00.000Z'),
'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',
'trellocardidshort': 1,
'trellodescription': 'some description',
'trelloshortlink': 'abcd',
'trelloshorturl': 'https://trello.com/c/AAaaBBbb',
'trellourl': 'https://trello.com/c/AAaBBbb/42-so-long',
'annotations': [