<commit_before>from django.test import TestCase
from django.test.client import Client

from metashare import test_utils
from metashare.settings import DJANGO_BASE, ROOT_PATH, DJANGO_URL, SITEMAP_URL


class SEOTest(TestCase):
    """
    Check the sitemap's and robots.txt's format
    """

    def test_sitemap(self):
        """
        Tests the correct appearance of the sitemap
        """
       
        imported_res = test_utils.import_xml('{}/repository/fixtures/'
          'testfixture.xml'.format(ROOT_PATH))[0]
        imported_res.storage_object.published = True
        imported_res.storage_object.save()
        client = Client()
        print "\n\n" + DJANGO_BASE + "\n\n"
        print "\n\n" + '/{0}sitemap.xml'.format(DJANGO_BASE) + "\n\n"
        
        # assert that a two-token search finds a camelCase term:
        response = client.get('/{0}sitemap.xml'.format(DJANGO_BASE))
        self.assertContains(response, 
          '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">', \
          status_code=200)
        self.assertContains(response, 
          '{}/repository/browse/italian-tts-speech-corpus-appen/' \
          .format(DJANGO_URL), status_code=200)


    def test_robots_txt(self):<commit_msg>Another attempt to fix jenkins.<commit_after>from django.test import TestCase
from django.test.client import Client

from metashare import test_utils
from metashare.settings import DJANGO_BASE, ROOT_PATH, DJANGO_URL, SITEMAP_URL


class SEOTest(TestCase):
    """
    Check the sitemap's and robots.txt's format
    """

    def test_sitemap(self):
        """
        Tests the correct appearance of the sitemap
        """
       
        imported_res = test_utils.import_xml('{}/repository/fixtures/'
          'testfixture.xml'.format(ROOT_PATH))[0]
        imported_res.storage_object.published = True
        imported_res.storage_object.save()
        client = Client()
        
        # assert that a two-token search finds a camelCase term:
        response = client.get(SITEMAP_URL)
        self.assertContains(response, 
          '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">', \
          status_code=200)
        self.assertContains(response, 
          '{}/repository/browse/italian-tts-speech-corpus-appen/' \
          .format(DJANGO_URL), status_code=200)


    def test_robots_txt(self):
{'fraction_non_alphanumeric': 0.11369399830938293, 'fraction_numerical': 0.0084530853761623, 'mean_word_length': 2.6984375, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 8}, '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': '2477675', 'n_tokens_mistral': 774, 'n_tokens_neox': 746, 'n_words': 141}