summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2009-06-24 18:10:52 +0200
committerHelmut Grohne <helmut@subdivi.de>2009-06-24 18:10:52 +0200
commit92a35e0e81725d6fa26df8a7cb88d22cb24575c3 (patch)
treedb50cfeff934ff42b858b87114ac85ad5abb9fe8
parentbdd4de6cfd3e5c8f4b5a246a47a6e42f737467c4 (diff)
downloadwsgitools-92a35e0e81725d6fa26df8a7cb88d22cb24575c3.tar.gz
added doctest for DBAPI2NonceStore
-rwxr-xr-xwsgitools/digest.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/wsgitools/digest.py b/wsgitools/digest.py
index d0039e0..c3485e7 100755
--- a/wsgitools/digest.py
+++ b/wsgitools/digest.py
@@ -333,6 +333,18 @@ class DBAPI2NonceStore(NonceStoreBase):
"""
A dbapi2-backed nonce store implementation suitable for usage with forking
wsgi servers such as scgi.forkpool.
+ >>> import sqlite3
+ >>> db = sqlite3.connect(":memory:")
+ >>> db.cursor().execute("CREATE TABLE nonces (key, value);") and None
+ >>> db.commit() and None
+ >>> s = DBAPI2NonceStore(db, maxuses=1)
+ >>> n = s.newnonce()
+ >>> s.checknonce("spam")
+ False
+ >>> s.checknonce(n)
+ True
+ >>> s.checknonce(n)
+ False
"""
def __init__(self, dbhandle, maxage=300, maxuses=5, table="nonces"):
"""