Skip to content

Commit

Permalink
Fix import bugs + bug in tests for card due date
Browse files Browse the repository at this point in the history
  • Loading branch information
nMustaki committed Jul 23, 2015
1 parent da57e62 commit be01f34
Show file tree
Hide file tree
Showing 13 changed files with 61 additions and 55 deletions.
2 changes: 1 addition & 1 deletion test/test_board.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def test52_add_card_set_due(self):
expected_due_date = card.due
# Refresh the due date from cloud
card.fetch()
actual_due_date = card.due[:10]
actual_due_date = card.due
self.assertEquals(expected_due_date, actual_due_date)

def test53_checklist(self):
Expand Down
22 changes: 11 additions & 11 deletions trello/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/usr/bin/python
from board import *
from card import *
from checklist import *
from exceptions import *
from label import *
from member import *
from organization import *
from trelloclient import *
from trellolist import *
from webhook import *
# -*- coding: utf-8 -*-
from trello.board import *
from trello.card import *
from trello.checklist import *
from trello.exceptions import *
from trello.label import *
from trello.member import *
from trello.organization import *
from trello.trelloclient import *
from trello.trellolist import *
from trello.webhook import *

# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
12 changes: 6 additions & 6 deletions trello/board.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/python
from __future__ import with_statement, print_function
from member import Member
from card import Card
from trellolist import List
from label import Label
# -*- coding: utf-8 -*-
from __future__ import with_statement, print_function, absolute_import
from trello.member import Member
from trello.card import Card
from trello.trellolist import List
from trello.label import Label


class Board(object):
Expand Down
19 changes: 10 additions & 9 deletions trello/card.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#!/usr/bin/python
from __future__ import with_statement, print_function
# -*- coding: utf-8 -*-
from __future__ import with_statement, print_function, absolute_import
from dateutil import parser as dateparser
from checklist import Checklist
from label import Label
import trellolist
from trello.checklist import Checklist
from trello.label import Label


class Card(object):
Expand Down Expand Up @@ -77,7 +76,7 @@ def __init__(self, parent, card_id, name=''):
:trello_list: reference to the parent list
:card_id: ID for this card
"""
if isinstance(parent, trellolist.List):
if isinstance(parent, List):
self.trello_list = parent
self.board = parent.board
else:
Expand Down Expand Up @@ -133,9 +132,8 @@ def fetch(self, eager=True):
self.labels = Label.from_json_list(self.board, json_obj['labels'])
self.badges = json_obj['badges']
self.pos = json_obj['pos']
# For consistency, due date is in YYYY-MM-DD format
if json_obj.get('due', ''):
self.due = json_obj.get('due', '')[:10]
self.due = json_obj.get('due', '')
else:
self.due = ''
self.checked = json_obj['checkItemStates']
Expand All @@ -156,7 +154,7 @@ def fetch_comments(self):

def get_list(self):
obj = self.client.fetch_json('/lists/' + self.idList)
return trellolist.List.from_json(board=self, json_obj=obj)
return List.from_json(board=self, json_obj=obj)

def get_comments(self):
comments = []
Expand Down Expand Up @@ -379,3 +377,6 @@ def _post_remote_data(self, attribute, files=None, **kwargs):
http_method='POST',
files=files,
post_args=kwargs)


from trello.trellolist import List
4 changes: 2 additions & 2 deletions trello/checklist.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/python
from __future__ import with_statement, print_function
# -*- coding: utf-8 -*-
from __future__ import with_statement, print_function, absolute_import


class Checklist(object):
Expand Down
3 changes: 1 addition & 2 deletions trello/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/python
from __future__ import with_statement, print_function
# -*- coding: utf-8 -*-


class ResourceUnavailable(Exception):
Expand Down
4 changes: 2 additions & 2 deletions trello/label.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/python
from __future__ import with_statement, print_function
# -*- coding: utf-8 -*-
from __future__ import with_statement, print_function, absolute_import


class Label(object):
Expand Down
4 changes: 2 additions & 2 deletions trello/member.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/python
from __future__ import with_statement, print_function
# -*- coding: utf-8 -*-
from __future__ import with_statement, print_function, absolute_import


class Member(object):
Expand Down
10 changes: 5 additions & 5 deletions trello/organization.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#!/usr/bin/python
from __future__ import with_statement, print_function
from board import Board
from member import Member
# -*- coding: utf-8 -*-
from __future__ import with_statement, print_function, absolute_import
from trello.board import Board
from trello.member import Member


class Organization(object):

"""
Class representing an organization
"""
def __init__(self, client, organization_id, name=''):
def __init__(self, client, organization_id, name=''):
self.client = client
self.id = organization_id
self.name = name
Expand Down
15 changes: 10 additions & 5 deletions trello/trelloclient.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
#!/usr/bin/python
from __future__ import with_statement, print_function
# -*- coding: utf-8 -*-
from __future__ import with_statement, print_function, absolute_import
import json
import requests
from requests_oauthlib import OAuth1
from board import Board
from card import Card
from exceptions import *
from trello.board import Board
from trello.card import Card
from trello.trellolist import List
from trello.organization import Organization
from trello.member import Member
from trello.webhook import WebHook
from trello.exceptions import *


class TrelloClient(object):
Expand Down
12 changes: 7 additions & 5 deletions trello/trellolist.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/usr/bin/python
from __future__ import with_statement, print_function
import card
# -*- coding: utf-8 -*-
from __future__ import with_statement, print_function, absolute_import


class List(object):
Expand Down Expand Up @@ -44,7 +43,7 @@ def fetch(self):
def list_cards(self):
"""Lists all cards in this list"""
json_obj = self.client.fetch_json('/lists/' + self.id + '/cards')
return [card.Card.from_json(self, c) for c in json_obj]
return [Card.from_json(self, c) for c in json_obj]

def add_card(self, name, desc=None, labels=[], due="null"):
"""Add a card to this list
Expand All @@ -61,7 +60,7 @@ def add_card(self, name, desc=None, labels=[], due="null"):
'/cards',
http_method='POST',
post_args={'name': name, 'idList': self.id, 'desc': desc, 'idLabels': labels_str[:-1], 'due': due})
return card.Card.from_json(self, json_obj)
return Card.from_json(self, json_obj)

def archive_all_cards(self):
self.client.fetch_json(
Expand Down Expand Up @@ -100,3 +99,6 @@ def open(self):

def cardsCnt(self):
return len(self.list_cards())


from trello.card import Card
5 changes: 2 additions & 3 deletions trello/util.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/python
from __future__ import with_statement, print_function
# -*- coding: utf-8 -*-
from __future__ import with_statement, print_function, absolute_import
import os

from requests_oauthlib import OAuth1Session


Expand Down
4 changes: 2 additions & 2 deletions trello/webhook.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/python
from __future__ import with_statement, print_function
# -*- coding: utf-8 -*-
from __future__ import with_statement, print_function, absolute_import


class WebHook(object):
Expand Down

0 comments on commit be01f34

Please sign in to comment.