def test_serialize_unserialize():
    dt = datetime(2011, 7, 9, 13, 14, 15)
    id = 59034

    sid = SessionID(id, dt)
    data = sid.serialize()

    SessionID(123)

    restored_sid = sid.unserialize(data)

    assert sid.id == restored_sid.id
    assert sid.created == restored_sid.created
Beispiel #2
0
def test_serialize_unserialize():
    dt = datetime(2011, 7, 9, 13, 14, 15)
    id = 59034

    sid = SessionID(id, dt)
    data = sid.serialize()

    SessionID(123)

    restored_sid = sid.unserialize(data)

    assert sid.id == restored_sid.id
    assert sid.created == restored_sid.created
Beispiel #3
0
def unserialize_session(sid_s):
    """Return the unserialized session.

    :param sid_s: The session ID.
    :returns: The unserialized version.
    """
    return SessionID.unserialize(sid_s)
Beispiel #4
0
def unserialize_session(sid_s):
    """Return the unserialized session.

    :param sid_s: The session ID.
    :returns: The unserialized version.
    """
    return SessionID.unserialize(sid_s)
Beispiel #5
0
def test_serialize():
    t = int(time.time())
    dt = datetime.utcfromtimestamp(t)
    sid = SessionID(1234, dt)

    assert "%x_%x" % (1234, t) == sid.serialize()
Beispiel #6
0
def test_automatic_created_date():
    start = datetime.utcnow()
    sid = SessionID(0)
    end = datetime.utcnow()

    assert start <= sid.created <= end
def unserialize_session(sid_s):
    """Return the unserialized session."""
    return SessionID.unserialize(sid_s)
Beispiel #8
0
def unserialize_session(sid_s):
    """Return the unserialized session."""
    return SessionID.unserialize(sid_s)
def test_serialize():
    t = int(time.time())
    dt = datetime.utcfromtimestamp(t)
    sid = SessionID(1234, dt)

    assert '%x_%x' % (1234, t) == sid.serialize()