<commit_before>import unittest
from stampman.services import pool


class TestAPIEndpoint(unittest.TestCase):
    pass<commit_msg>Add unit test for testing flask endpoint<commit_after>import unittest
import json

import requests
from stampman import main


class TestAPIRoot(unittest.TestCase):
    def setUp(self):
        self._port = "8000"
        self._path = "http://0.0.0.0"
        main.app.config['TESTING'] = True
        self._app = main.app.test_client()

    def testGetJson(self):
        response = self._app.get("/")
        expected_response = [
            {
                "services": [
                    {
                        "name": "mailgun",
                        "priority": 2
                    },
                    {
                        "name": "sendgrid",
                        "priority": 1
                    }
                ],
                "url": "http://localhost/mail.sshukla.de",
                "domain": "mail.sshukla.de"
            }
        ]
        response_dict = json.loads(str(response.data, 'utf-8'))
        self.assertEqual(response.status_code, 200)
        self.assertEqual(response.content_type, "application/json")
        self.assertEqual(response_dict, expected_response)
{'fraction_non_alphanumeric': 0.10986367281475541, 'fraction_numerical': 0.011226944667201283, 'mean_word_length': 1.578512396694215, 'pattern_counts': {'":': 7, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, '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': '744197', 'n_tokens_mistral': 350, 'n_tokens_neox': 324, 'n_words': 63}