'Test valid course with and without user specified.
Test skipped if git global config override environment variable GIT_CONFIG
is set.'

@unittest.skipIf((os.environ.get('GIT_CONFIG') or os.environ.get('GIT_AUTHOR_EMAIL') or os.environ.get('GIT_AUTHOR_NAME') or os.environ.get('GIT_COMMITTER_EMAIL') or os.environ.get('GIT_COMMITTER_NAME')), 'Global    git    override    set')
def test_git_ident(self):

    git_export_utils.export_to_git(self.course.id, 'file://{0}'.format(self.bare_repo_dir), 'enigma')
    expect_string = '{0}|{1}\n'.format(git_export_utils.GIT_EXPORT_DEFAULT_IDENT['name'], git_export_utils.GIT_EXPORT_DEFAULT_IDENT['email'])
    cwd = os.path.abspath((git_export_utils.GIT_REPO_EXPORT_DIR / 'test_bare'))
    git_log = subprocess.check_output(['git', 'log', '-1', '--format=%an|%ae'], cwd=cwd)
    self.assertEqual(expect_string, git_log)
    self.populate_course()
    git_export_utils.export_to_git(self.course.id, 'file://{0}'.format(self.bare_repo_dir), self.user.username)
    expect_string = '{0}|{1}\n'.format(self.user.username, self.user.email)
    git_log = subprocess.check_output(['git', 'log', '-1', '--format=%an|%ae'], cwd=cwd)
    self.assertEqual(expect_string, git_log)
