Skip to content

Commit

Permalink
repair tests
Browse files Browse the repository at this point in the history
  • Loading branch information
willronchetti committed Oct 31, 2023
1 parent e7edf82 commit eb4608e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ dcicutils
Change Log
----------

8.0.0.1c1
=========

* Updates for RAS to Redis API


8.0.0
=====

Expand Down
8 changes: 6 additions & 2 deletions test/test_redis_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def test_redis_session_basic(self, redisdb):
rd = RedisBase(redisdb)
session_token = RedisSessionToken(
namespace=self.NAMESPACE,
email=self.DUMMY_EMAIL,
jwt=self.DUMMY_JWT
)
session_token.store_session_token(redis_handler=rd)
Expand All @@ -34,7 +35,7 @@ def test_redis_session_basic(self, redisdb):
assert not session_token.validate_session_token(redis_handler=rd)
# update with a new token and expiration
session_token.redis_key = working_token
session_token.update_session_token(redis_handler=rd, jwt=self.DUMMY_JWT)
session_token.update_session_token(redis_handler=rd, email=self.DUMMY_EMAIL, jwt=self.DUMMY_JWT)
assert session_token.validate_session_token(redis_handler=rd)
session_token.redis_key = working_token
assert not session_token.validate_session_token(redis_handler=rd)
Expand All @@ -47,13 +48,14 @@ def test_redis_session_expired_token(self, redisdb):
with mock.patch.object(RedisSessionToken, '_build_session_expiration', self.mock_build_session_expiration):
session_token = RedisSessionToken(
namespace=self.NAMESPACE,
email=self.DUMMY_EMAIL,
jwt=self.DUMMY_JWT
)
session_token.store_session_token(redis_handler=rd)
time.sleep(2)
assert not session_token.validate_session_token(redis_handler=rd)
# update then should validate
session_token.update_session_token(redis_handler=rd, jwt=self.DUMMY_JWT)
session_token.update_session_token(redis_handler=rd, email=self.DUMMY_EMAIL, jwt=self.DUMMY_JWT)
assert session_token.validate_session_token(redis_handler=rd)

def test_redis_session_many_sessions(self, redisdb):
Expand All @@ -65,6 +67,7 @@ def test_redis_session_many_sessions(self, redisdb):
for _ in range(5):
session_token = RedisSessionToken(
namespace=self.NAMESPACE,
email=self.DUMMY_EMAIL,
jwt=self.DUMMY_JWT
)
session_token.store_session_token(redis_handler=rd)
Expand Down Expand Up @@ -92,6 +95,7 @@ def test_redis_session_from_redis_equality(self, redisdb):
rd = RedisBase(redisdb)
session_token_local = RedisSessionToken(
namespace=self.NAMESPACE,
email=self.DUMMY_EMAIL,
jwt=self.DUMMY_JWT
)
session_token_local.store_session_token(redis_handler=rd)
Expand Down

0 comments on commit eb4608e

Please sign in to comment.