Skip to content

Commit

Permalink
make sure that submitted events dont show up in search
Browse files Browse the repository at this point in the history
  • Loading branch information
gregsadetsky committed Mar 2, 2024
1 parent 5146a18 commit f84ef62
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions core/tests/test_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,22 @@ def test_database_event_search(self):
# find the title and the description in the results
self.assertContains(response, event_title)
self.assertContains(response, event_description)

def test_submitted_event_search(self):
# create an event that's user submitted i.e. not approved
event_title = " ".join(random.sample(RANDOM_WORDS, 10))
event_description = str(uuid.uuid4())
Event.objects.create(
title=event_title,
description=event_description,
starttime=get_current_new_york_datetime(),
is_approved=False,
)
# search for event
response = self.client.get("/", {"s": event_title})

self.assertEqual(response.status_code, 200)
# we should NOT find the description in the test results
# (note that we WOULD find the title, because it's shown as
# "search results for: <title>") but that doesn't count...! :-)
self.assertNotContains(response, event_description)

0 comments on commit f84ef62

Please sign in to comment.