Skip to content

Commit eb26e16

Browse files
author
Josh Hoyt
committed
[project @ Remove isDumb interface and dumbstore test]
1 parent 35a8c23 commit eb26e16

5 files changed

Lines changed: 3 additions & 49 deletions

File tree

‎openid/consumer/consumer.py‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -960,9 +960,6 @@ def _getAssociation(self, endpoint):
960960
@returns: A valid association for the endpoint's server_url or None
961961
@rtype: openid.association.Association or NoneType
962962
"""
963-
if self.store.isDumb():
964-
return None
965-
966963
assoc = self.store.getAssociation(endpoint.server_url)
967964

968965
if assoc is None or assoc.expiresIn <= 0:

‎openid/store/dumbstore.py‎

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,6 @@ def useNonce(self, server_url, timestamp, salt):
5353
replay attacks feasible during the lifespan of the token.
5454
5555
56-
@return: C{True}
57-
58-
@rtype: C{bool}
59-
"""
60-
return True
61-
62-
def isDumb(self):
63-
"""
64-
This store is a dumb mode store, so this method is overridden
65-
to return C{True}.
66-
67-
6856
@return: C{True}
6957
7058
@rtype: C{bool}

‎openid/store/interface.py‎

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -161,21 +161,3 @@ def useNonce(self, nonce):
161161
@rtype: C{bool} or C{int}
162162
"""
163163
raise NotImplementedError
164-
165-
def isDumb(self):
166-
"""
167-
This method must return C{True} if the store is a
168-
dumb-mode-style store. Unlike all other methods in this
169-
class, this one provides a default implementation, which
170-
returns C{False}.
171-
172-
In general, any custom subclass of C{L{OpenIDStore}} won't
173-
override this method, as custom subclasses are only likely to
174-
be created when the store is fully functional.
175-
176-
@return: C{True} if the store works fully, C{False} if the
177-
consumer will have to use dumb mode to use this store.
178-
179-
@rtype: C{bool}
180-
"""
181-
return False

‎openid/test/_memstore.py‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,6 @@ def _getServerAssocs(self, server_url):
4949
assocs = self.server_assocs[server_url] = ServerAssocs()
5050
return assocs
5151

52-
def isDumb(self):
53-
return False
54-
5552
def storeAssociation(self, server_url, assoc):
5653
assocs = self._getServerAssocs(server_url)
5754
assocs.set(copy.deepcopy(assoc))

‎openid/test/storetest.py‎

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,8 @@ def genAssoc(issued, lifetime=600):
5050

5151
def checkRetrieve(url, handle=None, expected=None):
5252
retrieved_assoc = store.getAssociation(url, handle)
53-
if expected is None or store.isDumb():
54-
assert retrieved_assoc is None
55-
else:
56-
assert retrieved_assoc == expected, (retrieved_assoc, expected)
53+
assert retrieved_assoc == expected, (retrieved_assoc, expected)
54+
if expected is not None:
5755
if retrieved_assoc is expected:
5856
print ('Unexpected: retrieved a reference to the expected '
5957
'value instead of a new object')
@@ -62,8 +60,7 @@ def checkRetrieve(url, handle=None, expected=None):
6260

6361
def checkRemove(url, handle, expected):
6462
present = store.removeAssociation(url, handle)
65-
expectedPresent = (not store.isDumb()) and expected
66-
assert bool(expectedPresent) == bool(present)
63+
assert bool(expected) == bool(present)
6764

6865
assoc = genAssoc(issued=0)
6966

@@ -155,7 +152,6 @@ def checkRemove(url, handle, expected):
155152
def checkUseNonce(nonce, expected, server_url):
156153
stamp, salt = split(nonce)
157154
actual = store.useNonce(server_url, stamp, salt)
158-
expected = store.isDumb() or expected
159155
assert bool(actual) == bool(expected)
160156

161157
for url in [server_url, '']:
@@ -310,11 +306,6 @@ def test_postgresql():
310306
cursor.execute('DROP DATABASE %s;' % (db_name,))
311307
conn_remove.close()
312308

313-
def test_dumbstore():
314-
from openid.store import dumbstore
315-
store = dumbstore.DumbStore()
316-
testStore(store)
317-
318309
def test_memstore():
319310
import _memstore
320311
testStore(_memstore.MemoryStore())
@@ -324,7 +315,6 @@ def test():
324315
test_sqlite()
325316
test_mysql()
326317
test_postgresql()
327-
test_dumbstore()
328318
test_memstore()
329319

330320
if __name__ == '__main__':

0 commit comments

Comments
 (0)