store sample git repo as dot_git, then copy when testing

This commit is contained in:
Alan Hamlett 2015-09-07 13:41:29 -07:00
parent b223138ab2
commit 2da040547a
3 changed files with 16 additions and 1 deletions

View file

@ -0,0 +1 @@
ref: refs/heads/master

View file

@ -0,0 +1,7 @@
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true

View file

@ -5,6 +5,9 @@ from wakatime.main import execute
from wakatime.packages import requests
from wakatime.packages.requests.models import Response
import os
import shutil
import tempfile
import time
from wakatime.compat import u
from . import utils
@ -55,8 +58,12 @@ class LanguagesTestCase(utils.TestCase):
response.status_code = 0
self.patched['wakatime.packages.requests.adapters.HTTPAdapter.send'].return_value = response
tempdir = tempfile.mkdtemp()
shutil.copytree('tests/samples/projects/git', os.path.join(tempdir, 'git'))
shutil.move(os.path.join(tempdir, 'git', 'dot_git'), os.path.join(tempdir, 'git', '.git'))
now = u(int(time.time()))
entity = 'tests/samples/projects/git/emptyfile.txt'
entity = os.path.join(tempdir, 'git', 'emptyfile.txt')
config = 'tests/samples/sample.cfg'
args = ['--file', entity, '--config', config, '--time', now]