<commit_before>from django.test import TestCase
from django.core.urlresolvers import reverse
from .factories import PageFactory
from waliki.settings import WALIKI_DATA_DIR
from waliki.models import Page
from waliki.git import Git
import json
import os
import shutil
from sh import git


class TestGitWebhook(TestCase):

    def setUp(self):
        self.content = "- item"
        self.page = PageFactory(path="page.rst", raw=self.content)
        Git().commit(self.page)
        self.remote = self.set_remote(True)
        self.url = reverse('waliki_webhook_pull', args=('origin',))

    def set_remote(self, chdir=False):
        # init
        remote = WALIKI_DATA_DIR + '_remote'
        git.clone(WALIKI_DATA_DIR, remote)
        os.chdir(WALIKI_DATA_DIR)
        git.remote('add', 'origin', remote)
        if chdir:
            os.chdir(remote)
        return remote

    def tearDown(self):
        try:
            shutil.rmtree(WALIKI_DATA_DIR)<commit_msg>travis i love you<commit_after>from django.test import TestCase
from django.core.urlresolvers import reverse
from .factories import PageFactory
from waliki.settings import WALIKI_DATA_DIR
from waliki.models import Page
from waliki.git import Git
import json
import os
import shutil
from sh import git


class TestGitWebhook(TestCase):

    def setUp(self):
        self.content = "- item"
        self.page = PageFactory(path="page.rst", raw=self.content)
        Git().commit(self.page)
        self.remote = self.set_remote(True)
        self.url = reverse('waliki_webhook_pull', args=('origin',))

    def set_remote(self, chdir=False):
        # init
        remote = WALIKI_DATA_DIR + '_remote'
        git.clone(WALIKI_DATA_DIR, remote)
        os.chdir(remote)
        git.config("user.email", '<EMAIL>')
        git.config("user.name", 'I am me, yo')

        os.chdir(WALIKI_DATA_DIR)
        git.remote('add', 'origin', remote)
        if chdir:
            os.chdir(remote)
        return remote

    def tearDown(self):
        try:
            shutil.rmtree(WALIKI_DATA_DIR)
{'fraction_non_alphanumeric': 0.10228933268387726, 'fraction_numerical': 0.0, 'mean_word_length': 2.8609022556390977, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4642309', 'n_tokens_mistral': 675, 'n_tokens_neox': 651, 'n_words': 152}