def test_widget_solr_count(self): """ Test facet extraction from solr response """ data = {'index': 'tags'} widget = CountableWidget(self.portal, self.request, data=data) dummyresponse = DummySolrResponse({'tags': {'foo': 10, 'bar': 7}}) self.assertEqual(widget.count(dummyresponse), {'': 1, 'all': 1, u'bar': 7, u'foo': 10})
def test_widget_solr_count(self): """ Test facet extraction from solr response """ data = {'index': 'tags'} widget = CountableWidget(self.portal, self.request, data=data) dummyresponse = DummySolrResponse({'tags': {'foo': 10, 'bar': 7}}) self.assertEqual(widget.count(dummyresponse), { '': 1, 'all': 1, u'bar': 7, u'foo': 10 })
def test_widget_empty_count(self): """ Empty count """ data = {} widget = CountableWidget(self.portal, self.request, data=data) self.assertEqual(widget.count([]), {})