Skip to content

Commit

Permalink
Merge pull request #1625 from dchiller/i1613-breakup-test-views
Browse files Browse the repository at this point in the history
  • Loading branch information
dchiller authored Sep 3, 2024
2 parents 28657a2 + f3931bb commit 8d785c2
Show file tree
Hide file tree
Showing 17 changed files with 6,722 additions and 6,558 deletions.
18 changes: 18 additions & 0 deletions django/cantusdb_project/main_app/tests/make_fakes.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,3 +451,21 @@ def make_fake_source(
source.other_editors.set([make_fake_user()])

return source


def get_random_search_term(target):
"""Helper function for generating a random slice of a string.
Args:
target (str): The content of the field to search.
Returns:
str: A random slice of `target`
"""
if len(target) <= 2:
search_term = target
else:
slice_start = random.randint(0, len(target) - 2)
slice_end = random.randint(slice_start + 2, len(target))
search_term = target[slice_start:slice_end]
return search_term
Loading

0 comments on commit 8d785c2

Please sign in to comment.