Skip to content

Commit

Permalink
Fix failing test (was failing on add_invitation).
Browse files Browse the repository at this point in the history
  • Loading branch information
dtgay committed Jun 13, 2013
1 parent 57b03be commit 1015377
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tahrir_api/dbapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ def issuer_exists(self, origin, name):
return session.query(Issuer)\
.filter_by(origin=origin, name=name).count() != 0

def add_invitation(self, badge_id, created_on=None, expires_on=None):
def add_invitation(self, badge_id, created_on=None, expires_on=None,
created_by=None):
"""
Add a new invitation to the database
Expand All @@ -178,6 +179,9 @@ def add_invitation(self, badge_id, created_on=None, expires_on=None):
:type expires_on: datetime.datetime
:param expires_on: When this invitation expires.
:type created_by: int
:param created_by: User ID of creator
"""

session = scoped_session(self.session_maker)
Expand All @@ -187,11 +191,13 @@ def add_invitation(self, badge_id, created_on=None, expires_on=None):

created_on = created_on or datetime.now()
expires_on = expires_on or (created_on + timedelta(hours=1))
created_by = created_by or 1 # This should be fine

invitation = Invitation(
created_on=created_on,
expires_on=expires_on,
badge_id=badge_id
badge_id=badge_id,
created_by=created_by,
)
session.add(invitation)
session.commit()
Expand Down

0 comments on commit 1015377

Please sign in to comment.