Skip to content

Commit

Permalink
Ensure draft version exists on dandiset created from zarr factory
Browse files Browse the repository at this point in the history
  • Loading branch information
jjnesbitt committed Dec 17, 2024
1 parent 38a90fb commit eb6fb85
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions dandiapi/zarr/tests/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@ class Meta:
name = factory.Faker('catch_phrase')
dandiset = factory.SubFactory(DandisetFactory)

@factory.post_generation
def ensure_draft_version(obj: ZarrArchive, *args, **kwargs): # type: ignore # noqa: N805, PGH003
from dandiapi.api.tests.factories import DraftVersionFactory

if obj.dandiset.versions.filter(version='draft').exists():
return

DraftVersionFactory(dandiset=obj.dandiset)


class EmbargoedZarrArchiveFactory(ZarrArchiveFactory):
embargoed = True

0 comments on commit eb6fb85

Please sign in to comment.