Exemplo n.º 1
0
    def _getenv():
        """Generate environment for process execution."""
        env = {'GIT_SSH': get_wrapper_filename()}

        # Add path to config if it exists
        userconfig = os.path.expanduser('~/.config/hub')
        if os.path.exists(userconfig):
            env['HUB_CONFIG'] = userconfig

        return get_clean_env(env)
Exemplo n.º 2
0
 def test_create_ssh_wrapper(self):
     check_data_writable()
     filename = get_wrapper_filename()
     create_ssh_wrapper()
     with open(filename, 'r') as handle:
         data = handle.read()
         self.assertTrue(ssh_file('known_hosts') in data)
         self.assertTrue(ssh_file('id_rsa') in data)
         self.assertTrue(settings.DATA_DIR in data)
     self.assertTrue(os.access(filename, os.X_OK))
     # Second run should not touch the file
     timestamp = os.stat(filename).st_mtime
     create_ssh_wrapper()
     self.assertEqual(timestamp, os.stat(filename).st_mtime)
Exemplo n.º 3
0
 def check_config(self):
     """Check VCS configuration."""
     # We directly set config as it takes same time as reading it
     self.set_config('ui.ssh', get_wrapper_filename())
Exemplo n.º 4
0
 def _getenv():
     """Generate environment for process execution."""
     return get_clean_env({'GIT_SSH': get_wrapper_filename()})