Esempio n. 1
0
    def test_view_by_taxonomy_name_json(self):
        classifier = self.db['classifier'].find_one({'taxonomy': 'cofog',
                                                     'name': '03'})

        url_ = classifier_url(classifier, format='json')
        result = self.app.get(url_)

        h.assert_equal(result.status, '200 OK')
        h.assert_equal(result.content_type, 'application/json')

        json_data = json.loads(result.body)
        h.assert_equal(json_data['name'], u'03')
        h.assert_equal(json_data['label'], classifier['label'])
        h.assert_equal(json_data['_id'], str(classifier['_id']))
Esempio n. 2
0
    def test_view_by_taxonomy_name_html(self):
        classifier = self.db['classifier'].find_one({'taxonomy': 'cofog',
                                                     'name': '03'})
        url_ = classifier_url(classifier)
        result = self.app.get(url_)

        h.assert_equal(result.status, '200 OK')

        # Links to entries json and csv and entries listing
        h.assert_true('<a href="/classifier/cofog/03/entries.json">'
                        in result)
        h.assert_true('<a href="/classifier/cofog/03/entries.csv">'
                        in result)
        h.assert_true('<a href="/classifier/cofog/03/entries">Search</a>'
                        in result)

        # Search box and result listing from the solr browser
        h.assert_true('class="search-form' in result)
        h.assert_equal(result.body.count('full entry'), 5)