def test_boards_listing(self, mocked_request): mocked_request.return_value.status_code = 200 mocked_request.return_value.json = lambda: [ { 'id': 'toto' } ] client = TrelloClient(self.TEST_CONSUMER_KEY, self.TEST_TOKEN) boards = client.list_boards() self.assertEqual(1, len(boards)) self.assertEqual(boards[0]['id'], 'toto') mocked_request.assert_called_once_with( data=None, method='get', params={'token': 'a_token', 'key': 'a_consumer_key'}, url='https://api.trello.com/1/members/me/boards' )
def test_invalid_status(self, mocked_request): mocked_request.return_value.status_code = 400 client = TrelloClient(self.TEST_CONSUMER_KEY, self.TEST_TOKEN) with self.assertRaises(TrelloClientException): client.list_boards()