Test 'office title' facet & allow no blank choice in facet response.

This commit is contained in:
Paul Makepeace 2011-04-24 15:59:32 -04:00
parent 0657c415b7
commit 9607c30bfa
2 changed files with 10 additions and 1 deletions

View File

@ -72,7 +72,10 @@ class FacetResponse(object):
for choice in facet['choices']:
self.choices[choice['v']['v']] = FacetChoice(choice)
if 'blankChoice' in facet:
self.blank_choice = FacetChoice(facet['blankChoice'])
else:
self.blank_choice = None
class FacetsResponse(object):

View File

@ -118,6 +118,12 @@ class TutorialTestFacets(RefineTestCase):
ethnicity_facet.reset()
response = self.project.get_rows()
self.assertEqual(response.filtered, 6958)
# {11}
office_title_facet = Facet('Office Title')
self.project.engine.add_facet(office_title_facet)
response = self.project.text_facet()
self.assertEqual(len(response.facets[2].choices), 76)
if __name__ == '__main__':
unittest.main()