Skip to content

Commit 46c3ed0

Browse files
committed
fix: remove more tests
1 parent 96f030d commit 46c3ed0

File tree

1 file changed

+0
-60
lines changed

1 file changed

+0
-60
lines changed

integration/test_auth.py

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -160,29 +160,6 @@ def test_session_cookies(api_key):
160160
estimated_exp = int(time.time() + expires_in.total_seconds())
161161
assert abs(claims['exp'] - estimated_exp) < 5
162162

163-
def test_session_cookies_with_tolerance(api_key):
164-
dev_claims = {'premium' : True, 'subscription' : 'silver'}
165-
custom_token = auth.create_custom_token('user3', dev_claims)
166-
id_token = _sign_in(custom_token, api_key)
167-
expires_in = datetime.timedelta(seconds=3)
168-
session_cookie = auth.create_session_cookie(id_token, expires_in=expires_in)
169-
time.sleep(4)
170-
# expect this to fail because the cookie is expired
171-
with pytest.raises(auth.ExpiredSessionCookieError):
172-
auth.verify_session_cookie(session_cookie)
173-
174-
# expect this to succeed because we're within the tolerance
175-
claims = auth.verify_session_cookie(session_cookie, check_revoked=False, clock_skew_seconds=2)
176-
assert claims['uid'] == 'user3'
177-
assert claims['premium'] is True
178-
assert claims['subscription'] == 'silver'
179-
assert claims['iss'].startswith('https://session.firebase.google.com')
180-
181-
with pytest.raises(ValueError):
182-
auth.verify_session_cookie(session_cookie, clock_skew_seconds=-1)
183-
with pytest.raises(ValueError):
184-
auth.verify_session_cookie(session_cookie, clock_skew_seconds=61)
185-
186163
def test_session_cookie_error():
187164
expires_in = datetime.timedelta(days=1)
188165
with pytest.raises(auth.InvalidIdTokenError):
@@ -640,43 +617,6 @@ def test_verify_session_cookie_revoked(new_user, api_key):
640617
claims = auth.verify_session_cookie(session_cookie, check_revoked=True)
641618
assert claims['iat'] * 1000 >= user.tokens_valid_after_timestamp
642619

643-
def test_verify_session_cookie_tolerance(new_user, api_key):
644-
expired_session_cookie = auth.create_session_cookie(
645-
_sign_in(auth.create_custom_token(new_user.uid), api_key),
646-
expires_in=datetime.timedelta(seconds=3)
647-
)
648-
time.sleep(3)
649-
# Verify the session cookie with a tolerance of 0 seconds. This should
650-
# raise an exception because the cookie is expired.
651-
with pytest.raises(auth.ExpiredSessionCookieError) as excinfo:
652-
auth.verify_session_cookie(expired_session_cookie, check_revoked=False,
653-
clock_skew_seconds=0)
654-
assert str(excinfo.value) == 'The Firebase session cookie is expired.'
655-
656-
# Verify the session cookie with a tolerance of 2 seconds. This should
657-
# not raise an exception because the cookie is within the tolerance.
658-
auth.verify_session_cookie(expired_session_cookie, check_revoked=False, clock_skew_seconds=2)
659-
660-
def test_verify_session_cookie_clock_skew_seconds_range(new_user, api_key):
661-
expired_session_cookie = auth.create_session_cookie(
662-
_sign_in(auth.create_custom_token(new_user.uid), api_key),
663-
expires_in=datetime.timedelta(seconds=3)
664-
)
665-
# Verify the session cookie with a tolerance of 0 seconds. This should
666-
# raise an exception because the cookie is expired.
667-
with pytest.raises(ValueError) as excinfo:
668-
auth.verify_session_cookie(
669-
expired_session_cookie, check_revoked=False, clock_skew_seconds=-1)
670-
assert str(excinfo.value) == 'clock_skew_seconds must be between 0 and 60.'
671-
with pytest.raises(ValueError) as excinfo:
672-
auth.verify_session_cookie(
673-
expired_session_cookie, check_revoked=False, clock_skew_seconds=61)
674-
assert str(excinfo.value) == 'clock_skew_seconds must be between 0 and 60.'
675-
676-
# Verify the session cookie with a tolerance of 2 seconds. This should
677-
# not raise an exception because the cookie is within the tolerance.
678-
auth.verify_session_cookie(expired_session_cookie, check_revoked=False, clock_skew_seconds=2)
679-
680620

681621
def test_verify_session_cookie_disabled(new_user, api_key):
682622
custom_token = auth.create_custom_token(new_user.uid)

0 commit comments

Comments
 (0)