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

from model_mommy import mommy

from django.core.urlresolvers import reverse
from rest_framework import status
from rest_framework.test import APITestCase

from tasks.models import TaskStatus


class TestResultTestCase(APITestCase):
    def setUp(self): # NOPMD
        self.test_run = mommy.make('test_runs.TestRun')
        self.task_to_delete = mommy.make('tasks.Task')
        self.result = mommy.make('results.TestResult')

    def test_create_task(self):
        url = reverse('task-list')

        payload = {
            'test_run': reverse('testrun-detail', args=[self.test_run.id, ]),
            'status': TaskStatus.PENDING,
            'results': [],
        }

        response = self.client.post(url, payload)
        self.assertEqual(response.status_code, status.HTTP_201_CREATED, msg='Create failed: {0}'.format(response.data))
<commit_msg>First try to get Sonar comply to coding style exceptions.<commit_after># -*- coding: utf-8 -*-
from __future__ import unicode_literals

from model_mommy import mommy

from django.core.urlresolvers import reverse
from rest_framework import status
from rest_framework.test import APITestCase

from tasks.models import TaskStatus


class TestResultTestCase(APITestCase):
    # NOPMD
    def setUp(self):
        self.test_run = mommy.make('test_runs.TestRun')
        self.task_to_delete = mommy.make('tasks.Task')
        self.result = mommy.make('results.TestResult')

    def test_create_task(self):
        url = reverse('task-list')

        payload = {
            'test_run': reverse('testrun-detail', args=[self.test_run.id, ]),
            'status': TaskStatus.PENDING,
            'results': [],
        }

        response = self.client.post(url, payload)
        self.assertEqual(response.status_code, status.HTTP_201_CREATED, msg='Create failed: {0}'.format(response.data))

{'fraction_non_alphanumeric': 0.1140625, 'fraction_numerical': 0.005208333333333333, 'mean_word_length': 3.2975391498881432, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1418229', 'n_tokens_mistral': 589, 'n_tokens_neox': 578, 'n_words': 123}