Exemple #1
0
 def _update_cookie(self):
     """
     Update all the cookie metadata.
     """
     cookie = self._cookie[self.name]
     cookie["path"] = self.path
     cookie["domain"] = self.domain
     if self.max_age:
         cookie["max-age"] = self.max_age
         fromtime = self.internal_data["_access"]
         cookie["expires"] = max_age_to_expires(self.max_age, fromtime)
     if self.secure:
         cookie["secure"] = self.secure
     if self.httponly:
         cookie["httponly"] = self.httponly
def test_max_age_to_expires_now():
    max_age = 0
    now = datetime.utcnow()
    assert max_age_to_expires(max_age) == \
        now.strftime('%a, %d-%b-%Y %H:%M:%S GMT')
def test_max_age_to_expires():
    max_age = 0
    basetime = datetime(2013, 01, 01, 14, 35, 23)
    fromtime = calendar.timegm(basetime.utctimetuple())
    assert max_age_to_expires(max_age, fromtime) == \
        'Tue, 01-Jan-2013 14:35:23 GMT'