diff --git a/django/cantusdb_project/main_app/tests/make_fakes.py b/django/cantusdb_project/main_app/tests/make_fakes.py index 931e347e8..15b9eb6eb 100644 --- a/django/cantusdb_project/main_app/tests/make_fakes.py +++ b/django/cantusdb_project/main_app/tests/make_fakes.py @@ -9,6 +9,7 @@ from main_app.models import Genre from main_app.models import Notation from main_app.models import Office +from main_app.models import Project from main_app.models import Provenance from main_app.models import Segment from main_app.models import Sequence @@ -151,7 +152,7 @@ def make_fake_chant( manuscript_syllabized_full_text=None, next_chant=None, differentia=None, - segment=None, + project=None, ) -> Chant: """Generates a fake Chant object.""" if source is None: @@ -189,8 +190,8 @@ def make_fake_chant( manuscript_syllabized_full_text = faker.sentence(20) if differentia is None: differentia = make_random_string(2) - if segment is None: - segment = make_fake_segment() + if project is None: + project = make_fake_project() chant = Chant.objects.create( source=source, @@ -225,7 +226,7 @@ def make_fake_chant( indexing_notes=faker.sentence(), json_info=None, next_chant=next_chant, - segment=segment, + project=project, ) chant.refresh_from_db() # several fields (e.g., incipit) are calculated automatically # upon chant save. By refreshing from db before returning, we ensure all the chant's fields @@ -303,6 +304,16 @@ def make_fake_segment(name: str = None, id: int = None) -> Segment: return segment +def make_fake_project(name: str = None, id: int = None) -> Project: + if name is None: + name = faker.sentence(nb_words=2) + if id is None: + project = Project.objects.create(name=name) + return project + project = Project.objects.create(name=name, id=id) + return project + + def make_fake_sequence(source=None, title=None, cantus_id=None) -> Sequence: """Generates a fake Sequence object.""" if source is None: