How to use the sshpubkeys.AuthorizedKeysFile function in sshpubkeys

To help you get started, we’ve selected a few sshpubkeys examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ojarva / python-sshpubkeys / tests / __init__.py View on Github external
def test_disallow_options(self):
        file_obj = StringIO("""command="dump /home",no-pty,no-port-forwarding """ + DEFAULT_KEY)
        self.assertRaises(InvalidOptionsError, AuthorizedKeysFile, file_obj, disallow_options=True)
        file_obj.seek(0)
        key_file = AuthorizedKeysFile(file_obj)
        self.assertEqual(len(key_file.keys), 1)
github ojarva / python-sshpubkeys / tests / __init__.py View on Github external
def check_valid_file(self, file_str, valid_keys_count):
        file_obj = StringIO(file_str)
        key_file = AuthorizedKeysFile(file_obj)
        for item in key_file.keys:
            self.assertIsInstance(item, SSHKey)
        self.assertEqual(len(key_file.keys), valid_keys_count)