Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
Now that `user.metadata` is created automatically, we can remove the
places in tests where it's manually created.
  • Loading branch information
mvandenburgh committed Jan 1, 2024
1 parent 6c6c4db commit d4542b6
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 17 deletions.
10 changes: 0 additions & 10 deletions dandiapi/api/tests/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,11 @@
EmbargoedAssetBlob,
EmbargoedUpload,
Upload,
UserMetadata,
Version,
)
from dandiapi.api.services.publish import publish_asset


class UserMetadataFactory(factory.django.DjangoModelFactory):
class Meta:
model = UserMetadata

status = UserMetadata.Status.APPROVED.value


class UserFactory(factory.django.DjangoModelFactory):
class Meta:
model = User
Expand All @@ -38,8 +30,6 @@ class Meta:
first_name = factory.Faker('first_name')
last_name = factory.Faker('last_name')

metadata = factory.RelatedFactory(UserMetadataFactory, factory_related_name='user')


class SocialAccountFactory(factory.django.DjangoModelFactory):
class Meta:
Expand Down
1 change: 0 additions & 1 deletion dandiapi/api/tests/test_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ def test_user_me(api_client, social_account):
def test_user_me_admin(api_client, admin_user, social_account_factory):
api_client.force_authenticate(user=admin_user)
social_account = social_account_factory(user=admin_user)
UserMetadata.objects.create(user=admin_user)

assert api_client.get(
'/api/users/me/',
Expand Down
6 changes: 0 additions & 6 deletions dandiapi/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,6 @@ def zarr_file_factory():
return upload_zarr_file


@pytest.fixture()
def user(user_factory):
"""Override the default `user` fixture to use our `UserFactory` so `UserMetadata` works."""
return user_factory()


@pytest.fixture(params=[DraftAssetFactory, PublishedAssetFactory], ids=['draft', 'published'])
def asset_factory(request):
return request.param
Expand Down

0 comments on commit d4542b6

Please sign in to comment.