<commit_before># -*- coding: utf-8 -*-
from __future__ import unicode_literals

"""

"""

import unittest

import os
from opendatahub.utils import cache

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'opendatahub.settings')

from authentication.models import UserProfile

from django.core.exceptions import ObjectDoesNotExist


BASE_DIR = os.path.abspath(os.path.dirname(__file__))
TEMP_DIR = os.path.join(BASE_DIR, 'temp')

cache.set = lambda *a, **k: None
cache.get = lambda *a, **k: None
cache.delete = lambda *a, **k: None


class TestBase(unittest.TestCase):
    """

    """

    username = 'testuser'
    email = username + '@opendatahub.ch'
    password = '<PASSWORD>'

    @classmethod
    def get_test_user(cls):
        try:
            user = UserProfile.objects.get(username=cls.username)
        except ObjectDoesNotExist:
            user = UserProfile.objects.create_user(username=cls.username, email=cls.email, password=cls.password)

        return user

    @classmethod
    def get_test_file_path(cls, file_path):
        return os.path.join(BASE_DIR, 'testdata', *file_path.split('/'))<commit_msg>only monkey patch when actually executing tests<commit_after># -*- coding: utf-8 -*-
from __future__ import unicode_literals

"""

"""

import unittest

import os
from opendatahub.utils import cache

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'opendatahub.settings')

from authentication.models import UserProfile

from django.core.exceptions import ObjectDoesNotExist


BASE_DIR = os.path.abspath(os.path.dirname(__file__))
TEMP_DIR = os.path.join(BASE_DIR, 'temp')


class TestBase(unittest.TestCase):
    """

    """

    username = 'testuser'
    email = username + '@opendatahub.ch'
    password = '<PASSWORD>'

    @classmethod
    def setUpClass(cls):
        cache.set = lambda *a, **k: None
        cache.get = lambda *a, **k: None
        cache.delete = lambda *a, **k: None

    @classmethod
    def get_test_user(cls):
        try:
            user = UserProfile.objects.get(username=cls.username)
        except ObjectDoesNotExist:
            user = UserProfile.objects.create_user(username=cls.username, email=cls.email, password=<PASSWORD>)

        return user

    @classmethod
    def get_test_file_path(cls, file_path):
        return os.path.join(BASE_DIR, 'testdata', *file_path.split('/'))
{'fraction_non_alphanumeric': 0.12189905902480752, 'fraction_numerical': 0.000855431993156544, 'mean_word_length': 3.5594541910331383, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, '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': '7234473', 'n_tokens_mistral': 758, 'n_tokens_neox': 742, 'n_words': 160}