Skip to content

Commit

Permalink
Add tests for person autocomplete methods
Browse files Browse the repository at this point in the history
  • Loading branch information
rlskoeser committed Aug 9, 2023
1 parent 6f40cb3 commit 0102559
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions cdhweb/people/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,22 @@ def test_latest_grant(self, db, projects_landing_page):
grant2.save()
assert person.latest_grant == grant2

def test_autocomplete_label(self, staffer):
assert staffer.autocomplete_label() == str(staffer)

def test_autocomplete_custom_queryset_filter(self, staffer, postdoc, student):
# look for something that will match all three
results = Person.autocomplete_custom_queryset_filter("s")
# all three have s
assert results.count() == 3
for p in [staffer, postdoc, student]:
assert p in results

# search for just one (staffer)
results = Person.autocomplete_custom_queryset_filter("aff")
assert results.count() == 1
assert staffer in results


def test_profile_url(student, staffer, staffer_profile, faculty_pi):
# student fixture has neither profile nor website link
Expand Down

0 comments on commit 0102559

Please sign in to comment.