Beispiel #1
0
def test_decode_token_invalid_input_7(mocked_fetch_public_key,
                                      mocked_get_audiences):
    """Test the handling wrong JWT tokens."""
    payload = {'some': 'payload', 'email_verified': '0'}
    token = jwt.encode(payload, PRIVATE_KEY, algorithm='RS256').decode("utf-8")
    with pytest.raises(jwt.InvalidIssuerError):
        assert decode_user_token(token) is not None
Beispiel #2
0
def test_decode_token_invalid_input_2(mocked_fetch_public_key,
                                      mocked_get_audiences):
    """Test the invalid input handling during token decoding."""
    with pytest.raises(Exception):
        assert decode_user_token("Foobar") is None
Beispiel #3
0
def test_decode_token_invalid_input_1(mocked_fetch_public_key,
                                      mocked_get_audiences):
    """Test the invalid input handling during token decoding."""
    assert decode_user_token(None) == {}
Beispiel #4
0
def test_decode_token_invalid_input_5(mocked_fetch_public_key,
                                      mocked_get_audiences):
    """Test the handling wrong JWT tokens."""
    with pytest.raises(Exception):
        assert decode_user_token("Bearer something") is None