mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-02-07 20:00:20 +00:00
Add a test for the bad key case of unauthorized ssh key checking.
This commit is contained in:
parent
f3cb2d42d7
commit
79a6be565b
@ -48,3 +48,18 @@ class AccountFileCheckerKeyTests(unittest.TestCase):
|
|||||||
b"dennis", b"md5", None, None, None)
|
b"dennis", b"md5", None, None, None)
|
||||||
avatarId = self.checker.requestAvatarId(key_credentials)
|
avatarId = self.checker.requestAvatarId(key_credentials)
|
||||||
return self.assertFailure(avatarId, error.UnauthorizedLogin)
|
return self.assertFailure(avatarId, error.UnauthorizedLogin)
|
||||||
|
|
||||||
|
def test_unrecognized_key(self):
|
||||||
|
"""
|
||||||
|
AccountFileChecker.requestAvatarId returns a Deferred that fires with
|
||||||
|
UnauthorizedLogin if called with an SSHPrivateKey object with a public
|
||||||
|
key other than the one indicated in the account file for the indicated
|
||||||
|
user.
|
||||||
|
"""
|
||||||
|
wrong_key_blob = b"""\
|
||||||
|
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAYQDJGMWlPXh2M3pYzTiamjcBIMqctt4VvLVW2QZgEFc86XhGjPXq5QAiRTKv9yVZJR9HW70CfBI7GHun8+v4Wb6aicWBoxgI3OB5NN+OUywdme2HSaif5yenFdQr0ME71Xs=
|
||||||
|
"""
|
||||||
|
key_credentials = credentials.SSHPrivateKey(
|
||||||
|
b"carol", b"md5", wrong_key_blob, None, None)
|
||||||
|
avatarId = self.checker.requestAvatarId(key_credentials)
|
||||||
|
return self.assertFailure(avatarId, error.UnauthorizedLogin)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user