<commit_before># coding: utf-8
from .. import consts
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse

from django.test import TestCase
from division_perm import models


class BaseTest(TestCase):
    view_path = None
    fixtures = ['perm_func']

    def setUp(self):
        self.user = User.objects.create_user(username='tester', email='<EMAIL>', password='<PASSWORD>')
        other_user = User.objects.create_user(username='other_user', email='<EMAIL>', password='<PASSWORD>')
        empl = models.Employee.objects.create(user=self.user, last_name='other_test', first_name='other_test', middle_name='other_test')
        other_empl = models.Employee.objects.create(user=other_user, last_name='test', first_name='test', middle_name='test')
        func_edit = models.Func.objects.get(code=consts.SYS_EDIT_FUNC)
        division = models.Division.objects.create(name='TechSupport')
        division.employees.add(empl)
        role_edit = models.Role.objects.create(name='Manager', code=func_edit.code, level=9, division=division)
        empl.roles.add(role_edit)
        empl.full_access.add(division)
        other_empl.full_access.add(division)
        division.full_access.add(division)
        self.client.login(username=self.user.username, password='<PASSWORD>')


    def get_url(self):
        url = reverse(self.view_path)
        return url<commit_msg>#9 -дополнила новым подразделением, убрала generate_data<commit_after># coding: utf-8
from .. import consts
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse

from django.test import TestCase
from division_perm import models


class BaseTest(TestCase):
    view_path = None
    fixtures = ['perm_func']

    def setUp(self):
        self.user = User.objects.create_user(username='tester', email='<EMAIL>', password='<PASSWORD>')
        other_user = User.objects.create_user(username='other_user', email='<EMAIL>', password='<PASSWORD>')
        empl = models.Employee.objects.create(user=self.user, last_name='other_test', first_name='other_test', middle_name='other_test')
        other_empl = models.Employee.objects.create(user=other_user, last_name='test', first_name='test', middle_name='test')
        func_edit = models.Func.objects.get(code=consts.SYS_EDIT_FUNC)
        func_read = models.Func.objects.get(code=consts.SYS_READ_FUNC)
        division = models.Division.objects.create(name='TechSupport')
        division2 = models.Division.objects.create(name='Systema')
        division.employees.add(empl)
        division2.employees.add(empl)
        role_edit = models.Role.objects.create(name='Manager', code=func_edit.code, level=9, division=division)
        role_edit2 = models.Role.objects.create(name='Operator', code=func_read.code, level=7, division=division2)
        empl.roles.add(role_edit, role_edit2)
        empl.full_access.add(division, division2)
        other_empl.full_access.add(division, division2)
        division.full_access.add(division, division2)

        self.client.login(username=self.user.username, password='<PASSWORD>')


    def get_url(self):
        url = reverse(self.view_path)
        return url
{'fraction_non_alphanumeric': 0.1258609893550407, 'fraction_numerical': 0.004383218534752661, 'mean_word_length': 4.254934210526316, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '3799647', 'n_tokens_mistral': 1009, 'n_tokens_neox': 982, 'n_words': 158}