Example #1
0
 def test_get_key_info_invalid(self):
     with open(self.authorized_keys, 'w') as f:
         f.write(INVALID_KEY)
     with self.assertRaises(SystemExit):
         ssh_key.ssh_key_info(authorized_keys = self.authorized_keys)
     self.assertError('SSH key did not match expected format '
         '\\"ssh-rsa <BASE64_KEY> COMMENT\\".')
Example #2
0
 def test_get_key_info_locked(self):
     with open(self.authorized_keys, 'w') as f:
         f.write(SMALL_KEY)
     self.assertEqual(
         {"comment": "my@address",
          "locked": True,
          "exists": True,
          "contents": SMALL_KEY
         }, ssh_key.ssh_key_info(authorized_keys = self.authorized_keys))
Example #3
0
 def test_get_key_info_empty(self):
     self.assertEqual({"exists": False},
         ssh_key.ssh_key_info(authorized_keys = self.authorized_keys))