<commit_before>"""
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".

Replace this with more appropriate tests for your application.
"""

# standard library

# django
from django.contrib import admin
from django.core.urlresolvers import NoReverseMatch
from django.core.urlresolvers import resolve
from django.core.urlresolvers import reverse
from django.db import models
from django.test import TestCase

# urls
from project.urls import urlpatterns

# utils
from inflection import underscore
from base.utils import get_our_models

# utils
from base.mockups import Mockup


class BaseTestCase(TestCase, Mockup):

    def setUp(self):
        super(BaseTestCase, self).setUp()

        self.password = <PASSWORD>()
        self.user = self.create_user(self.password)

        self.login()

    def login(self, user=None, password=<PASSWORD>):
        if user is None:
            user = self.user
            password = <PASSWORD>

        return self.client.login(email=user.email, password=password)


class IntegrityOnDeleteTestCase(BaseTestCase):
    def create_full_object(self, model):
        kwargs = {}
        for f in model._meta.fields:
            if isinstance(f, models.fields.related.ForeignKey) and f.null:
                model_name = underscore(f.rel.to.__name__)
                method_name = 'create_{}'.format(model_name)<commit_msg>Fix BaseTestCase usage of random_string<commit_after>"""
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".

Replace this with more appropriate tests for your application.
"""

# standard library

# django
from django.contrib import admin
from django.core.urlresolvers import NoReverseMatch
from django.core.urlresolvers import resolve
from django.core.urlresolvers import reverse
from django.db import models
from django.test import TestCase

# urls
from project.urls import urlpatterns

# utils
from inflection import underscore
from base.utils import get_our_models
from base.utils import random_string

# utils
from base.mockups import Mockup


class BaseTestCase(TestCase, Mockup):

    def setUp(self):
        super(BaseTestCase, self).setUp()

        self.password = <PASSWORD>()
        self.user = self.create_user(self.password)

        self.login()

    def login(self, user=None, password=None):
        if user is None:
            user = self.user
            password = self.password

        return self.client.login(email=user.email, password=password)


class IntegrityOnDeleteTestCase(BaseTestCase):
    def create_full_object(self, model):
        kwargs = {}
        for f in model._meta.fields:
            if isinstance(f, models.fields.related.ForeignKey) and f.null:
                model_name = underscore(f.rel.to.__name__)
                method_name = 'create_{}'.format(model_name)
{'fraction_non_alphanumeric': 0.08102493074792244, 'fraction_numerical': 0.0, 'mean_word_length': 3.344360902255639, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '3338097', 'n_tokens_mistral': 807, 'n_tokens_neox': 787, 'n_words': 245}