Best Python code snippet using localstack_python
tests.py
Source:tests.py
...132>>> s.get_expiry_age() == settings.SESSION_COOKIE_AGE133True134# So does a custom session with an idle expiration time of 0 (but it'll expire135# at browser close)136>>> s.set_expiry(0)137>>> s.get_expiry_age() == settings.SESSION_COOKIE_AGE138True139# Custom session idle expiration time140>>> s.set_expiry(10)141>>> delta = s.get_expiry_date() - datetime.now()142>>> delta.seconds in (9, 10)143True144>>> age = s.get_expiry_age()145>>> age in (9, 10)146True147# Custom session fixed expiry date (timedelta)148>>> s.set_expiry(td10)149>>> delta = s.get_expiry_date() - datetime.now()150>>> delta.seconds in (9, 10)151True152>>> age = s.get_expiry_age()153>>> age in (9, 10)154True155# Custom session fixed expiry date (fixed datetime)156>>> s.set_expiry(datetime.now() + td10)157>>> delta = s.get_expiry_date() - datetime.now()158>>> delta.seconds in (9, 10)159True160>>> age = s.get_expiry_age()161>>> age in (9, 10)162True163# Set back to default session age164>>> s.set_expiry(None)165>>> s.get_expiry_age() == settings.SESSION_COOKIE_AGE166True167# Allow to set back to default session age even if no alternate has been set168>>> s.set_expiry(None)169# We're changing the setting then reverting back to the original setting at the170# end of these tests.171>>> original_expire_at_browser_close = settings.SESSION_EXPIRE_AT_BROWSER_CLOSE172>>> settings.SESSION_EXPIRE_AT_BROWSER_CLOSE = False173# Custom session age174>>> s.set_expiry(10)175>>> s.get_expire_at_browser_close()176False177# Custom expire-at-browser-close178>>> s.set_expiry(0)179>>> s.get_expire_at_browser_close()180True181# Default session age182>>> s.set_expiry(None)183>>> s.get_expire_at_browser_close()184False185>>> settings.SESSION_EXPIRE_AT_BROWSER_CLOSE = True186# Custom session age187>>> s.set_expiry(10)188>>> s.get_expire_at_browser_close()189False190# Custom expire-at-browser-close191>>> s.set_expiry(0)192>>> s.get_expire_at_browser_close()193True194# Default session age195>>> s.set_expiry(None)196>>> s.get_expire_at_browser_close()197True198>>> settings.SESSION_EXPIRE_AT_BROWSER_CLOSE = original_expire_at_browser_close199"""200if __name__ == '__main__':201 import doctest...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!