from django.test import TestCase
import json
import logging

from readthedocs.projects.models import Project
from readthedocs.projects import tasks

log = logging.getLogger(__name__)


class GitLabWebHookTest(TestCase):
    fixtures = ["eric", "test_data"]

    def tearDown(self):
        tasks.update_docs = self.old_bd

    def setUp(self):
        self.old_bd = tasks.update_docs

        def mock(*args, **kwargs):
            log.info("Mocking for great profit and speed.")
        tasks.update_docs = mock
        tasks.update_docs.apply_async = mock

        self.client.login(username='eric', password='test')