<commit_before>from __future__ import unicode_literals

import django
from django.test import TestCase

from scheduler.sync.job_type_manager import JobTypeManager


class TestJobTypeManager(TestCase):

    def setUp(self):
        django.setup()

    def test_successful_update(self):
        """Tests doing a successful database update"""

        manager = JobTypeManager()
        manager.sync_with_database()<commit_msg>Added unit test for JSON status generation for job types<commit_after>from __future__ import unicode_literals

import django
from django.test import TestCase

from scheduler.sync.job_type_manager import JobTypeManager


class TestJobTypeManager(TestCase):

    fixtures = ['basic_system_job_types.json']

    def setUp(self):
        django.setup()

    def test_successful_update_and_create_json(self):
        """Tests doing a successful database update and creating status JSON"""

        manager = JobTypeManager()
        manager.sync_with_database()
        status_dict = {}
        manager.generate_status_json(status_dict)

        self.assertEqual(len(status_dict['job_types']), 1)
{'fraction_non_alphanumeric': 0.07354260089686099, 'fraction_numerical': 0.0008968609865470852, 'mean_word_length': 4.072727272727272, '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': '5319387', 'n_tokens_mistral': 307, 'n_tokens_neox': 295, 'n_words': 78}