Skip to content
This repository has been archived by the owner on Mar 22, 2018. It is now read-only.

Commit

Permalink
part of #254 - fixing a test, adding an other.
Browse files Browse the repository at this point in the history
  • Loading branch information
mfrasca committed Jan 2, 2016
1 parent 525e8f1 commit 57320ce
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions bauble/test/test_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -706,12 +706,33 @@ def test_search_by_query_synonyms(self):
g4.accepted = g3
self.session.commit()

prefs.prefs['bauble.search.return_synonyms'] = True
mapper_search = search.get_strategy('SynonymSearch')

s = 'Schetti'
results = mapper_search.search(s, self.session)
self.assertEqual(results, [g3])

def test_search_by_query_synonyms_disabled(self):
"""SynonymSearch strategy gives all synonyms of given taxon."""
Family = self.Family
Genus = self.Genus
family2 = Family(family=u'family2')
g2 = Genus(family=family2, genus=u'genus2')
f3 = Family(family=u'fam3', qualifier=u's. lat.')
g3 = Genus(family=f3, genus=u'Ixora')
g4 = Genus(family=f3, genus=u'Schetti')
self.session.add_all([family2, g2, f3, g3, g4])
g4.accepted = g3
self.session.commit()

prefs.prefs['bauble.search.return_synonyms'] = False
mapper_search = search.get_strategy('SynonymSearch')

s = 'Schetti'
results = mapper_search.search(s, self.session)
self.assertEqual(results, [])

def test_search_by_query_vernacural(self):
"""can find species by vernacular name"""

Expand Down

0 comments on commit 57320ce

Please sign in to comment.