<commit_before>#!/usr/bin/env python
# encoding: utf-8
import unittest
from utils.config_parser import ConfigData
from redmine.redreq import get_project_data


class ParseConfigTestCase(unittest.TestCase):

    """

    Base test class for test the fields
    of the ConfigFile processed properly.

    """
    def testConfRetrieval(self):
        self.assertEqual(type(ConfigData().url), str)
        self.assertEqual(type(ConfigData().key), str)
        self.assertEqual(type(ConfigData().project), str)

    def testProjectCall(self):
        success, data_or_msg = get_project_data(ConfigData())
        self.assertEqual(success, True)


if __name__ == '__main__':
    unittest.main()<commit_msg>finished tests of main workflow<commit_after>#!/usr/bin/env python
# encoding: utf-8
import unittest
from utils.config_parser import ConfigData
from redmine.redreq import get_project_data
from utils.transformator import restructure_data
import json


class MainWorkflowTestCase(unittest.TestCase):
    """
        Base test class for ConfigFile processed properly,
        connect to pm-tool and retrieve data, and jsonfy.
    """

    def setUp(self):
        self.cfg = ConfigData()
        self.success, self.data_or_msg = get_project_data(self.cfg)
        self.restructured = restructure_data(self.data_or_msg, self.cfg.project,
                                        '%s' % self.cfg.url + self.cfg.project)

    def testConfRetrieval(self):
        self.assertEqual(type(self.cfg.url), str)
        self.assertEqual(type(self.cfg.key), str)
        self.assertEqual(type(self.cfg.project), str)

    def testProjectCall(self):
        self.assertEqual(self.success, True)

    def testRestructuring(self):
        self.assertEqual('info' in self.restructured, True)
        self.assertEqual('task' in self.restructured, True)
        self.assertEqual('story' in self.restructured, True)

    def testTransformation(self):
        final_data = json.dumps(self.restructured, indent=4, sort_keys=True)
        self.assertEqual(type(final_data), str)


if __name__ == '__main__':
    unittest.main()
{'fraction_non_alphanumeric': 0.10466222645099905, 'fraction_numerical': 0.0014272121788772598, 'mean_word_length': 3.372141372141372, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7168984', 'n_tokens_mistral': 624, 'n_tokens_neox': 610, 'n_words': 138}