Example #1
0
 def test_apply_config_writes_pubkeys_to_authkey_file(self):
     pubkeys.apply_config(self.fixture)
     contents = pubkeys.PREAMBLE + "ssh-rsa henk\n\nssh-rsa ingrid\n\n"
     self.mock_writefile.assert_called_once_with(pubkeys.AUTHKEYS, contents, umask=0022)
Example #2
0
 def test_apply_config_chowns_the_users_dotssh_dir(self):
     pubkeys.apply_config(self.fixture)
     self.mock_chown.assert_called_once_with(pubkeys.DOTSSH, 1000, 1000)
Example #3
0
 def test_apply_config_creates_the_users_dotssh_dir_if_not_exists(self):
     self.setUpPatch('os.path.isdir', mock.Mock(return_value=False))
     pubkeys.apply_config(self.fixture)
     self.mock_mkdir.assert_called_once_with(pubkeys.DOTSSH, 0755)
Example #4
0
 def test_apply_config_does_not_create_dotssh_dir_if_exists(self):
     self.setUpPatch('os.path.isdir', mock.Mock(return_value=True))
     pubkeys.apply_config(self.fixture)
     self.assertEquals(len(self.mock_mkdir.mock_calls), 0)
Example #5
0
 def test_apply_config_checks_if_pubkeys_are_set(self):
     pubkeys.apply_config(self.fixture)
     self.mock_checkvars.assert_called_once_with(self.fixture, ["public_keys"])