Пример #1
0
    def test_update(self):
        w = WaitingLoan.new(user_key="U1", book_key="B1")
        assert w['status'] == 'waiting'
        w.update(status='avaialble')
        assert w['status'] == 'avaialble'

        w2 = WaitingLoan.find(user_key="U1", book_key="B1")
        assert w2['status'] == 'avaialble'
Пример #2
0
    def test_update(self):
        w = WaitingLoan.new(user_key="U1", identifier="B1")
        assert w["status"] == "waiting"
        w.update(status="avaialble")
        assert w["status"] == "avaialble"

        w2 = WaitingLoan.find(user_key="U1", identifier="B1")
        assert w2["status"] == "avaialble"
Пример #3
0
 def test_new(self):
     book_key = '/books/OL1234M'
     user_key = '/people/user1'
     WaitingLoan.new(book_key=book_key, 
                     user_key=user_key)
     
     w = WaitingLoan.find(book_key=book_key, user_key=user_key)
     assert w is not None
     assert w['status'] == 'waiting'
     assert w['book_key'] == book_key
     assert w['user_key'] == user_key
     assert isinstance(w['since'], datetime.datetime)
     assert isinstance(w['last_update'], datetime.datetime)
     assert w['expiry'] is None
     assert w['available_email_sent'] is False