<commit_before>from django.core.urlresolvers import reverse

from django.test import TransactionTestCase


class ContentViewTestCase(TransactionTestCase):

    """ Tests for content view check """

    def setUp(self):
        self.url_index = reverse('content:index')
        self.url_genres = reverse('content:genres')
        self.url_gallery = reverse('content:gallery')
        self.url_contacts = reverse('content:contacts')

    def test_url_resolved(self):
        """ Check url reverse correct """
        self.assertEqual(self.url_index, '/')
        self.assertEqual(self.url_genres, '/genres')
        self.assertEqual(self.url_gallery, '/gallery')
        self.assertEqual(self.url_contacts, '/contacts')

    def test_index_page(self):
        """ Get 200 on index page """
        response = self.client.get(self.url_index)
        self.assertEqual(response.status_code, 200)
        self.assertIn('Сохраните лучшие моменты...', response.content.decode('utf-8'))

    def test_genres_page(self):
        """ Get 200 on genres page """
        response = self.client.get(self.url_genres)
        self.assertEqual(response.status_code, 200)
        self.assertIn(
            '<li><a href="%s" class=\'active\'>Жанры</a></li>' % self.url_genres,
            response.content.decode('utf-8'))

    def test_gallery_page(self):
        """ Get 200 on gallery page """
        response = self.client.get(self.url_gallery)
        self.assertEqual(response.status_code, 200)
        self.assertIn(
            '<li><a href="%s" class=\'active\'>Галерея</a></li>' % self.url_gallery,
            response.content.decode('utf-8'))

    def test_contacts_page(self):
        """ Get 200 on contacts page """
        response = self.client.get(self.url_contacts)
        self.assertEqual(response.status_code, 200)
        self.assertIn(
            '<li><a href="%s" class=\'active\'>Контакты</a></li>' % self.url_contacts,
            response.content.decode('utf-8'))

    def test_contacts_page_post(self):
        """ Correct send msg """
        response = self.client.post(self.url_contacts, data=dict(
            name='Пользователь', email='<EMAIL>', message='Здравствуйте, хочу заказать фотосессию'))
        self.assertEqual(response.status_code, 200)
        self.assertIn(
            '<li><a href="%s" class=\'active\'>Контакты</a></li>' % self.url_contacts,
            response.content.decode('utf-8'))<commit_msg>:white_check_mark: upd test for content views;<commit_after>from django.core.urlresolvers import reverse

from django.test import TransactionTestCase


class ContentViewTestCase(TransactionTestCase):

    """ Tests for content view check """

    def setUp(self):
        self.url_index = reverse('content:index')
        self.url_genres = reverse('content:genres')
        self.url_gallery = reverse('content:gallery')
        self.url_contacts = reverse('content:contacts')

    def test_url_resolved(self):
        """ Check url reverse correct """
        self.assertEqual(self.url_index, '/')
        self.assertEqual(self.url_genres, '/genres')
        self.assertEqual(self.url_gallery, '/gallery')
        self.assertEqual(self.url_contacts, '/contacts')

    def test_index_page(self):
        """ Get 200 on index page """
        response = self.client.get(self.url_index)
        self.assertEqual(response.status_code, 200)
        self.assertIn('Сохраните лучшие моменты...', response.content.decode('utf-8'))

    def test_genres_page(self):
        """ Get 200 on genres page """
        response = self.client.get(self.url_genres)
        self.assertEqual(response.status_code, 200)
        self.assertIn(
            '<li><a href="%s" class=\'active\'>Жанры</a></li>' % self.url_genres,
            response.content.decode('utf-8'))

    def test_gallery_page(self):
        """ Get 200 on gallery page """
        response = self.client.get(self.url_gallery)
        self.assertEqual(response.status_code, 200)
        self.assertIn(
            '<li><a href="%s" class=\'active\'>Галерея</a></li>' % self.url_gallery,
            response.content.decode('utf-8'))

    def test_contacts_page(self):
        """ Get 200 on contacts page """
        response = self.client.get(self.url_contacts)
        self.assertEqual(response.status_code, 200)
        self.assertIn(
            '<li><a href="%s" class=\'active\'>Контакты</a></li>' % self.url_contacts,
            response.content.decode('utf-8'))

    def test_contacts_page_post(self):
        """ Correct send msg """
        response = self.client.post(self.url_contacts, data=dict(
            name='Пользователь', email='<EMAIL>', message='Здравствуйте, хочу заказать фотосессию'))
        self.assertEqual(response.status_code, 302)
        response = self.client.get(response.url)
        self.assertIn(
            '<li><a href="%s" class=\'active\'>Контакты</a></li>' % self.url_contacts,
            response.content.decode('utf-8'))
{'fraction_non_alphanumeric': 0.1460016155088853, 'fraction_numerical': 0.012924071082390954, 'mean_word_length': 2.9123222748815167, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 37, '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': '6594844', 'n_tokens_mistral': 1587, 'n_tokens_neox': 1530, 'n_words': 258}