Exemplo n.º 1
0
 def test_str(self):
     # test unicode, str
     today = date.today()
     yesterday = today - timedelta(days=1)
     at = AccessToken(token="foobar", expires_on=today, is_active=True)
     self.assertEqual(
         unicode(at),
         u"foobar - valid until %s" % today
     )
     at.is_active = False
     self.assertEqual(
         unicode(at),
         u"foobar - inactive"
     )
     at.is_active = True
     at.expires_on = yesterday
     self.assertEqual(
         unicode(at),
         u"foobar - expired on %s" % yesterday
     )