<commit_before>import json
from django.test import TestCase
from django.urls import reverse

from trix.project.develop.testhelpers.user import create_user
from trix.project.develop.testhelpers.login import LoginTestCaseMixin
from trix.trix_core import models


class TestHowSolved(TestCase, LoginTestCaseMixin):
    def setUp(self):
        self.testuser = create_user('<EMAIL>')
        self.assignment = models.Assignment.objects.create(title='Test')

    def _geturl(self, id):
        return reverse('trix_student_howsolved', args=[id])

    def test_create(self):
        self.assertEquals(models.HowSolved.objects.count(), 0)
        response = self.post_as(
            self.testuser, self._geturl(self.assignment.id),
            content_type='application/json',
            data=json.dumps({
                'howsolved': 'bymyself'
            })
        )
        self.assertEquals(response.status_code, 200)<commit_msg>Fixed tests by including consent datetime when creating user<commit_after>import json
from django.test import TestCase
from django.urls import reverse
from django.utils import timezone

from trix.project.develop.testhelpers.user import create_user
from trix.project.develop.testhelpers.login import LoginTestCaseMixin
from trix.trix_core import models


class TestHowSolved(TestCase, LoginTestCaseMixin):
    def setUp(self):
        self.testuser = create_user('<EMAIL>', consent_datetime=timezone.now())
        self.assignment = models.Assignment.objects.create(title='Test')

    def _geturl(self, id):
        return reverse('trix_student_howsolved', args=[id])

    def test_create(self):
        self.assertEquals(models.HowSolved.objects.count(), 0)
        response = self.post_as(
            self.testuser, self._geturl(self.assignment.id),
            content_type='application/json',
            data=json.dumps({
                'howsolved': 'bymyself'
            })
        )
        self.assertEquals(response.status_code, 200)
{'fraction_non_alphanumeric': 0.10030395136778116, 'fraction_numerical': 0.004052684903748734, 'mean_word_length': 3.3122270742358078, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '6259466', 'n_tokens_mistral': 573, 'n_tokens_neox': 564, 'n_words': 114}