<commit_before>import unittest
from tests.common import load_check
from checks import AgentCheck

class SshTestCase(unittest.TestCase):

    def test_ssh(self):

        config = {
            'instances': [{
                'host': 'sdf.org',
                'port': 22,
                'username': 'datadog01',
                'password': '<PASSWORD>',
                'sftp_check': False,
                'private_key_file': '',
                'add_missing_keys': True
            },
            {
                'host': 'sdf.org',
                'port': 22,
                'username': 'wrongusername',
                'password': '<PASSWORD>',
                'sftp_check': False,
                'private_key_file': '',
                'add_missing_keys': True
            },
            {
                'host': 'wronghost',
                'port': 22,
                'username': 'datadog01',
                'password': '<PASSWORD>',
                'sftp_check': False,
                'private_key_file': '',
                'add_missing_keys': True
            },
            ]
        }

        agentConfig = {}
        self.check = load_check('ssh_check', config, agentConfig)

        #Testing that connection will work
        self.check.check(config['instances'][0])

        service = self.check.get_service_checks()
        self.assertEqual(service[0].get('status'), AgentCheck.OK)
        self.assertEqual(service[0].get('message'), None)

        #Testing that bad authentication will raise exception
        self.assertRaises(Exception, self.check.check, config['instances'][1])
        #Testing that bad hostname will raise exception
        self.assertRaises(Exception, self.check.check, config['instances'][2])
        service_fail = self.check.get_service_checks()
        self.assertEqual(service_fail[0].get('status'), AgentCheck.CRITICAL)<commit_msg>Commenting Code<commit_after>import unittest
from tests.common import load_check
from checks import AgentCheck

class SshTestCase(unittest.TestCase):

    def test_ssh(self):

        config = {
            'instances': [{
                'host': 'sdf.org',
                'port': 22,
                'username': 'datadog01',
                'password': '<PASSWORD>',
                'sftp_check': False,
                'private_key_file': '',
                'add_missing_keys': True
            },
            {
                'host': 'sdf.org',
                'port': 22,
                'username': 'wrongusername',
                'password': '<PASSWORD>',
                'sftp_check': False,
                'private_key_file': '',
                'add_missing_keys': True
            },
            {
                'host': 'wronghost',
                'port': 22,
                'username': 'datadog01',
                'password': '<PASSWORD>',
                'sftp_check': False,
                'private_key_file': '',
                'add_missing_keys': True
            },
            ]
        }

        agentConfig = {}
        self.check = load_check('ssh_check', config, agentConfig)

        #Testing that connection will work
        self.check.check(config['instances'][0])

        service = self.check.get_service_checks()
        self.assertEqual(service[0].get('status'), AgentCheck.OK)
        self.assertEqual(service[0].get('message'), None)

        #Testing that bad authentication will raise exception
        self.assertRaises(Exception, self.check.check, config['instances'][1])
        #Testing that bad hostname will raise exception
        self.assertRaises(Exception, self.check.check, config['instances'][2])
        service_fail = self.check.get_service_checks()
        #Check failure status
        self.assertEqual(service_fail[0].get('status'), AgentCheck.CRITICAL)
{'fraction_non_alphanumeric': 0.12447368421052632, 'fraction_numerical': 0.008421052631578947, 'mean_word_length': 1.7325664989216392, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '4857804', 'n_tokens_mistral': 1063, 'n_tokens_neox': 979, 'n_words': 195}