<commit_before># coding: utf8
import zeit.cms.testing
import zeit.find.testing


class TestSearch(zeit.cms.testing.SeleniumTestCase):

    layer = zeit.find.testing.SELENIUM_LAYER
    skin = 'vivi'

    def setUp(self):
        super(TestSearch, self).setUp()
        zeit.find.testing.LAYER.set_result(
            'zeit.find.tests', 'data/obama.json')
        self.open('/find')
        self.selenium.waitForElementPresent('css=div.teaser_title')
        self.selenium.waitForVisible('css=div.teaser_title')

    def test_extended_search_display(self):
        s = self.selenium
        s.verifyNotVisible('id=extended_search')
        s.click('id=extended_search_button')
        s.waitForVisible('id=extended_search')
        s.verifyNotVisible('id=extended_search_info')
        s.type('name=author', 'Foo bar')
        s.click('id=extended_search_button')
        s.waitForVisible('id=extended_search_info')
        s.verifyNotVisible('id=extended_search')
        s.verifyText('css=#extended_search_info span', 'Foo bar')

    def test_type_search_display(self):
        s = self.selenium
        s.verifyNotVisible('id=type_search')
        s.click('id=type_search_button')
        s.waitForVisible('id=type_search')
        s.verifyNotVisible('id=type_search_info')
        s.click('id=search-type-unknown')
        s.click('id=type_search_button')
        s.waitForVisible('id=type_search_info')
        s.verifyNotVisible('id=type_search')
        s.verifyText('css=#type_search_info span', 'Unknown Resource')
<commit_msg>TMS-240: Set up actually available content types for tests<commit_after># coding: utf8
import mock
import zeit.cms.testing
import zeit.find.testing


class TestSearch(zeit.cms.testing.SeleniumTestCase):

    layer = zeit.find.testing.SELENIUM_LAYER
    skin = 'vivi'

    def setUp(self):
        super(TestSearch, self).setUp()
        zeit.find.testing.LAYER.set_result(
            'zeit.find.tests', 'data/obama.json')
        self.types_patch = mock.patch(
            'zeit.find.browser.find.SearchForm.CONTENT_TYPES',
            new=['collection', 'file', 'image', 'testcontenttype', 'unknown'])
        self.types_patch.start()
        self.open('/find')
        self.selenium.waitForElementPresent('css=div.teaser_title')
        self.selenium.waitForVisible('css=div.teaser_title')

    def tearDown(self):
        self.types_patch.stop()
        super(TestSearch, self).tearDown()

    def test_extended_search_display(self):
        s = self.selenium
        s.verifyNotVisible('id=extended_search')
        s.click('id=extended_search_button')
        s.waitForVisible('id=extended_search')
        s.verifyNotVisible('id=extended_search_info')
        s.type('name=author', 'Foo bar')
        s.click('id=extended_search_button')
        s.waitForVisible('id=extended_search_info')
        s.verifyNotVisible('id=extended_search')
        s.verifyText('css=#extended_search_info span', 'Foo bar')

    def test_type_search_display(self):
        s = self.selenium
        s.verifyNotVisible('id=type_search')
        s.click('id=type_search_button')
        s.waitForVisible('id=type_search')
        s.verifyNotVisible('id=type_search_info')
        s.click('id=search-type-unknown')
        s.click('id=type_search_button')
        s.waitForVisible('id=type_search_info')
        s.verifyNotVisible('id=type_search')
        s.verifyText('css=#type_search_info span', 'Unknown Resource')

{'fraction_non_alphanumeric': 0.12997964524571096, 'fraction_numerical': 0.0014539110206455365, 'mean_word_length': 3.321608040201005, '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': '6429834', 'n_tokens_mistral': 1139, 'n_tokens_neox': 1086, 'n_words': 138}