<commit_before>from django.core.urlresolvers import resolve
from django.test import TestCase
from django.http import HttpRequest
from django.test import LiveServerTestCase
from django.contrib.auth.models import User
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from github.views import *
import os


class HomePageTest(TestCase):

    def test_root_url_resolves_to_index_page_view(self):
        found = resolve('/')
        self.assertEqual(found.func, index)

    def test_home_page_returns_correct_html(self):
        request = HttpRequest()
        response = index(request)
        self.assertTrue(response.content.startswith(b'<html>'))
        self.assertIn(b'<title>Hiren: The Bunny</title>', response.content)
        self.assertIn(
            b'<a href="/login"><i class="fa fa-sign-in"></i> Login</a>', response.content)
        self.assertTrue(response.content.endswith(b'</html>'))


class LoginFunctionalTest(LiveServerTestCase):

    def setUp(self):
        User.objects.create_superuser(
            username='admin', password='<PASSWORD>', email='<EMAIL>')
        if 'TRAVIS' in os.environ:
            username = os.environ["SAUCE_USERNAME"]
            access_key = os.environ["SAUCE_ACCESS_KEY"]
            hub_url = "%s:%s@localhost:4445" % (username, access_key)
            capabilities['platform'] = "WINDOWS"
            capabilities['version'] = "10"
            browser = webdriver.Remote(desired_capabilities=capabilities,
                command_executor="http://%s/wd/hub" % hub_url)
        else:
            self.browser = webdriver.Firefox()
            self.browser.maximize_window()<commit_msg>fix issue<commit_after>from django.core.urlresolvers import resolve
from django.test import TestCase
from django.http import HttpRequest
from django.test import LiveServerTestCase
from django.contrib.auth.models import User
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from github.views import *
import os


class HomePageTest(TestCase):

    def test_root_url_resolves_to_index_page_view(self):
        found = resolve('/')
        self.assertEqual(found.func, index)

    def test_home_page_returns_correct_html(self):
        request = HttpRequest()
        response = index(request)
        self.assertTrue(response.content.startswith(b'<html>'))
        self.assertIn(b'<title>Hiren: The Bunny</title>', response.content)
        self.assertIn(
            b'<a href="/login"><i class="fa fa-sign-in"></i> Login</a>', response.content)
        self.assertTrue(response.content.endswith(b'</html>'))


class LoginFunctionalTest(LiveServerTestCase):

    def setUp(self):
        User.objects.create_superuser(
            username='admin', password='<PASSWORD>', email='<EMAIL>')
        if 'TRAVIS' in os.environ:
            username = os.environ["SAUCE_USERNAME"]
            access_key = os.environ["SAUCE_ACCESS_KEY"]
            hub_url = "%s:%s@localhost:4445" % (username, access_key)
            capabilities = []
            capabilities['platform'] = "WINDOWS"
            capabilities['version'] = "10"
            browser = webdriver.Remote(desired_capabilities=capabilities,
                command_executor="http://%s/wd/hub" % hub_url)
        else:
            self.browser = webdriver.Firefox()
            self.browser.maximize_window()
{'fraction_non_alphanumeric': 0.1181547619047619, 'fraction_numerical': 0.0035714285714285713, 'mean_word_length': 3.1855541718555416, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, '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': '603914', 'n_tokens_mistral': 989, 'n_tokens_neox': 975, 'n_words': 185}