-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
58 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,6 +47,41 @@ async def test_server_ban(lobby_server, user): | |
} | ||
|
||
|
||
@pytest.mark.parametrize("user", [ | ||
("Dostya", 2), | ||
("ban_long_time", 203) | ||
]) | ||
async def test_server_ban_token(lobby_server, user, jwk_priv_key, jwk_kid): | ||
user_name, id = user | ||
proto = await connect_client(lobby_server) | ||
await proto.send_message({ | ||
"command": "auth", | ||
"version": "1.0.0-dev", | ||
"user_agent": "faf-client", | ||
"token": jwt.encode({ | ||
"sub": id, | ||
"user_name": user_name, | ||
"scp": ["lobby"], | ||
"exp": int(time() + 1000), | ||
"authorities": [], | ||
"non_locked": True, | ||
"jti": "", | ||
"client_id": "" | ||
}, jwk_priv_key, algorithm="RS256", headers={"kid": jwk_kid}), | ||
"unique_id": "some_id" | ||
}) | ||
msg = await proto.read_message() | ||
assert msg == { | ||
"command": "notice", | ||
"style": "error", | ||
"text": ( | ||
"You are banned from FAF forever. <br>Reason: <br>Test permanent ban" | ||
"<br><i>If you would like to appeal this ban, please send an email " | ||
"to: [email protected]</i>" | ||
) | ||
} | ||
|
||
|
||
@pytest.mark.parametrize("user", ["ban_revoked", "ban_expired"]) | ||
async def test_server_ban_revoked_or_expired(lobby_server, user): | ||
proto = await connect_client(lobby_server) | ||
|