<commit_before>from django.test import Client, TestCase
from django.core.urlresolvers import reverse
from django.contrib.staticfiles import finders
from app.settings import BASE_DIR

class TestViews(TestCase):
    """
    Use the test client to get all of the views and test that the correct template was used.
    """
    def test_home(self):
        url = reverse('home')
        self.assertEqual(url, '/')
        response = self.client.get(url)
        self.assertEqual(response.status_code, 200)
        self.assertTemplateUsed(response, 'home.html')

    def test_discography(self):
        url = reverse('discography')
        self.assertEqual(url, '/discography')
        response = self.client.get(url)
        self.assertEqual(response.status_code, 200)
        self.assertTemplateUsed(response, 'discography.html')

    def test_members(self):
        url = reverse('members')
        self.assertEqual(url, '/members')
        response = self.client.get(url)
        self.assertEqual(response.status_code, 200)
        self.assertTemplateUsed(response, 'members.html')

    def test_tour(self):
        url = reverse('tour')
        self.assertEqual(url, '/tour')
        response = self.client.get(url)
        self.assertEqual(response.status_code, 200)
        self.assertTemplateUsed(response, 'tour.html')

    def test_static_config(self):
        """
        Tests the static file configuration to make sure
        that the app looks in the static folder.
        """
        result = finders.find('dummy_filename')
        searched_locations = finders.searched_locations
        self.assertIn(BASE_DIR+'/app/static', searched_locations)


<commit_msg>more test on view functions<commit_after>from django.test import Client, TestCase
from django.test.client import RequestFactory
from django.core.urlresolvers import reverse
from django.contrib.staticfiles import finders
from app.settings import STATICFILES_DIRS
from app.views import home, discography, tour, members


class TestViews(TestCase):
    """
    Use the test client to get all of the views and test that the correct template was used.
    """

    def setUp(self):
        self.factory = RequestFactory()


    def test_home_url(self):
        url = reverse('home')
        self.assertEqual(url, '/')
        response = self.client.get(url)
        self.assertEqual(response.status_code, 200)
        self.assertTemplateUsed(response, 'home.html')

    def test_home_view(self):
        # Create an instance of a GET request.
        request = self.factory.get('/')
        response = home(request)
        self.assertEqual(response.status_code, 200)

    def test_discography_url(self):
        url = reverse('discography')
        self.assertEqual(url, '/discography')
        response = self.client.get(url)
        self.assertEqual(response.status_code, 200)
        self.assertTemplateUsed(response, 'discography.html')

    def test_discography_view(self):
        # Create an instance of a GET request.
        request = self.factory.get('/discography')
        response = discography(request)
        self.assertEqual(response.status_code, 200)

    def test_members_url(self):
        url = reverse('members')
        self.assertEqual(url, '/members')
        response = self.client.get(url)
        self.assertEqual(response.status_code, 200)
        self.assertTemplateUsed(response, 'members.html')

    def test_members_view(self):
        # Create an instance of a GET request.
        request = self.factory.get('/members')
        response = members(request)
        self.assertEqual(response.status_code, 200)

    def test_tour_url(self):
        url = reverse('tour')
        self.assertEqual(url, '/tour')
        response = self.client.get(url)
        self.assertEqual(response.status_code, 200)
        self.assertTemplateUsed(response, 'tour.html')

    def test_tour_view(self):
        # Create an instance of a GET request.
        request = self.factory.get('/tour')
        response = tour(request)
        self.assertEqual(response.status_code, 200)

    def test_static_config(self):
        """
        Tests the static file configuration to make sure
        that the app looks in the static folder paths.
        """
        result = finders.find('dummy_filename')
        searched_locations = finders.searched_locations
        for d in STATICFILES_DIRS:
            self.assertIn(d, searched_locations)



{'fraction_non_alphanumeric': 0.10013562386980109, 'fraction_numerical': 0.0081374321880651, 'mean_word_length': 2.8612565445026177, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3542646', 'n_tokens_mistral': 1272, 'n_tokens_neox': 1192, 'n_words': 300}