<commit_before>import os

from django.conf import settings
from django.test import Client, TestCase
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from django.utils import simplejson

import views
from account.views import account_page
from project.utils import get_sftp_connection, get_ssh_connection, AESCipher


class SSHPageTestCases(TestCase):
    def setUp(self):
        user = User.objects.create_user("testerman", email="<EMAIL>", password="<PASSWORD>")
        user.save()
        self.client = Client()

    def test_job_index(self):
        response = self.client.get(reverse(views.job_index))
        self.assertEqual(response.status_code, 302)

        r = self.client.login(username="testerman", password="<PASSWORD>")
        self.assertTrue(r)
        response = self.client.get(reverse(views.job_index))
        self.assertEqual(response.status_code, 200)

    def test_get_job_list(self):
        response = self.client.get(reverse(views.get_job_list))
        self.assertEqual(response.status_code, 302)

    def test_get_job_list_auth(self):
        user = User.objects.get(username="testerman")
        r = self.client.login(username="testerman", password="<PASSWORD>")
        self.assertTrue(r)

        response = self.client.get(reverse(views.get_job_list))
        self.assertEqual(response.status_code, 200)
        data = simplejson.loads(response.content)
        self.assertTrue(data["is_authenticated"])


class SSHSettings(TestCase):
    user = {
        "username": "testerman",
        "email": "<EMAIL>",
        "password": "<PASSWORD>",
    }
    def setUp(self):
        user = User.objects.create_user(self.user["username"], email=self.user["email"], password=self.user["password"])
        user.save()
        self.client = Client()

    def test_add_cluster(self):
        r = self.client.login(username=self.user["username"], password=self.user["password"])
        self.assertTrue(r)

        response = self.client.get(reverse(account_page, args=(self.user["username"], "clusters")))
        self.assertEqual(response.status_code, 200)
        data = {
            "name": "test-machine",
            "hostname": "test-machine.com",<commit_msg>Fix add cluster test case by adding port<commit_after>import os

from django.conf import settings
from django.test import Client, TestCase
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from django.utils import simplejson

import views
from account.views import account_page
from project.utils import get_sftp_connection, get_ssh_connection, AESCipher


class SSHPageTestCases(TestCase):
    def setUp(self):
        user = User.objects.create_user("testerman", email="<EMAIL>", password="<PASSWORD>")
        user.save()
        self.client = Client()

    def test_job_index(self):
        response = self.client.get(reverse(views.job_index))
        self.assertEqual(response.status_code, 302)

        r = self.client.login(username="testerman", password="<PASSWORD>")
        self.assertTrue(r)
        response = self.client.get(reverse(views.job_index))
        self.assertEqual(response.status_code, 200)

    def test_get_job_list(self):
        response = self.client.get(reverse(views.get_job_list))
        self.assertEqual(response.status_code, 302)

    def test_get_job_list_auth(self):
        user = User.objects.get(username="testerman")
        r = self.client.login(username="testerman", password="<PASSWORD>")
        self.assertTrue(r)

        response = self.client.get(reverse(views.get_job_list))
        self.assertEqual(response.status_code, 200)
        data = simplejson.loads(response.content)
        self.assertTrue(data["is_authenticated"])


class SSHSettings(TestCase):
    user = {
        "username": "testerman",
        "email": "<EMAIL>",
        "password": "<PASSWORD>",
    }
    def setUp(self):
        user = User.objects.create_user(self.user["username"], email=self.user["email"], password=self.user["password"])
        user.save()
        self.client = Client()

    def test_add_cluster(self):
        r = self.client.login(username=self.user["username"], password=self.user["password"])
        self.assertTrue(r)

        response = self.client.get(reverse(account_page, args=(self.user["username"], "clusters")))
        self.assertEqual(response.status_code, 200)
        data = {
            "name": "test-machine",
            "hostname": "test-machine.com",
            "port": 22,
{'fraction_non_alphanumeric': 0.12940394416131176, 'fraction_numerical': 0.0070906270773321515, 'mean_word_length': 3.416829745596869, 'pattern_counts': {'":': 11, '<': 15, '<?xml version=': 0, '>': 15, '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': '299309', 'n_tokens_mistral': 1363, 'n_tokens_neox': 1318, 'n_words': 240}