<commit_before>from django.test import TestCase

from .models import Category
from .models import Article


class CategoryModelTest(TestCase):
    """The unit test cases for Category Model"""

    def test_string_representation(self):
        '''Test whether the string representation is equal to its title'''
        category = Category(title="My Category Title")
        self.assertEquals(str(category), category.title)

    def test_category_name_plural(self):
        """Test whether the plural name is correct"""
        self.assertEquals(str(Category._meta.verbose_name_plural), "categories")



class ArticleModelTest(TestCase):
    """The unit test cases for Article Model"""

    def test_string_representation(self):
        '''Test whether the string representation is equal to its title'''
        article = Article(title="My Article Title")
        self.assertEquals(str(article), article.title)



class ResponseCodeTest(TestCase):
    """The unit test cases for checking the correct response codes for various URL's"""

    fixtures = ['fixtures.json']

    def test_homepage(self):
        """When user visits homepage he should get 200"""
        response = self.client.get('/')
        self.assertEquals(response.status_code, 200)

    def test_detail_page_proper(self):
        """When the page exists and is published (we are using fixtures to seed the data) we should get 200"""
        response = self.client.get('/blog/18/')
        self.assertEquals(response.status_code, 200)

    def test_detail_page_not_published(self):
        """When the page is not published yet (ie., publishing date is in future), we need to send 404 response"""
        response = self.client.get('/blog/25/')
        self.assertEquals(response.status_code, 404)

    def test_detail_page_not_exist(self):
        """When the page does not exist, visiting the page should return 404"""
        response = self.client.get('/blog/1000/')
        self.assertEquals(response.status_code, 404)<commit_msg>Correcting the test cases<commit_after>from django.test import TestCase

from .models import Category
from .models import Article


class CategoryModelTest(TestCase):
    """The unit test cases for Category Model"""

    def test_string_representation(self):
        '''Test whether the string representation is equal to its title'''
        category = Category(title="My Category Title")
        self.assertEquals(str(category), category.title)

    def test_category_name_plural(self):
        """Test whether the plural name is correct"""
        self.assertEquals(str(Category._meta.verbose_name_plural), "categories")



class ArticleModelTest(TestCase):
    """The unit test cases for Article Model"""

    def test_string_representation(self):
        '''Test whether the string representation is equal to its title'''
        article = Article(title="My Article Title")
        self.assertEquals(str(article), article.title)



class ResponseCodeTest(TestCase):
    """The unit test cases for checking the correct response codes for various URL's"""

    fixtures = ['fixtures.json']

    def test_homepage(self):
        """When user visits homepage he should get 200"""
        response = self.client.get('/')
        self.assertEquals(response.status_code, 200)

    def test_detail_page_proper(self):
        """When the page exists and is published (we are using fixtures to seed the data) we should get 200"""
        response = self.client.get('/blog/omnia-peccata-paria-dicitis/')
        self.assertEquals(response.status_code, 200)

    def test_detail_page_not_published(self):
        """When the page is not published yet (ie., publishing date is in future), we need to send 404 response"""
        response = self.client.get('/blog/si-quicquam-extra-virtutem-habeatur/')
        self.assertEquals(response.status_code, 404)

    def test_detail_page_not_exist(self):
        """When the page does not exist, visiting the page should return 404"""
        response = self.client.get('/blog/asdf/')
        self.assertEquals(response.status_code, 404)
{'fraction_non_alphanumeric': 0.10240667976424361, 'fraction_numerical': 0.0137524557956778, 'mean_word_length': 3.561030235162374, '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': '5583377', 'n_tokens_mistral': 1125, 'n_tokens_neox': 1030, 'n_words': 354}