def test_git_require_sudo_user(gituser):
 from fabtools.require.git import working_copy
 (username, groupname) = gituser
 with cd('/tmp'):
  try:
   working_copy(REMOTE_URL, path='wc_nobody', use_sudo=True, user=username)
   assert is_dir('wc_nobody')
   assert is_dir('wc_nobody/.git')
   with cd('wc_nobody'):
    remotes = sudo('git remote -v', user=username)
    assert (remotes == 'origin DCTB https://github.com/disko/fabtools.git (fetch)\r\norigin DCTB https://github.com/disko/fabtools.git (push)')
    assert (_current_branch() == 'master')
   assert (owner('wc_nobody') == username)
   assert (group('wc_nobody') == groupname)
  finally:
   run_as_root('rm -rf wc_nobody')

def test_git_require_sudo_user ( gituser ) : from fabtools . require . git import working_copy ( username , groupname ) = gituser with cd ( '/tmp' ) : try : working_copy ( REMOTE_URL , path = 'wc_nobody' , use_sudo = True , user = username ) assert is_dir ( 'wc_nobody' ) assert is_dir ( 'wc_nobody/.git' ) with cd ( 'wc_nobody' ) : remotes = sudo ( 'git remote -v' , user = username ) assert ( remotes == 'origin DCTB https://github.com/disko/fabtools.git (fetch)\r\norigin DCTB https://github.com/disko/fabtools.git (push)' ) assert ( _current_branch ( ) == 'master' ) assert ( owner ( 'wc_nobody' ) == username ) assert ( group ( 'wc_nobody' ) == groupname ) finally : run_as_root ( 'rm -rf wc_nobody' )
test working_copy() with sudo as a user .