From d4542b6de716158da8b9dc24fd58464538ccd3aa Mon Sep 17 00:00:00 2001 From: Mike VanDenburgh Date: Fri, 1 Dec 2023 14:10:47 -0500 Subject: [PATCH] Update tests Now that `user.metadata` is created automatically, we can remove the places in tests where it's manually created. --- dandiapi/api/tests/factories.py | 10 ---------- dandiapi/api/tests/test_users.py | 1 - dandiapi/conftest.py | 6 ------ 3 files changed, 17 deletions(-) diff --git a/dandiapi/api/tests/factories.py b/dandiapi/api/tests/factories.py index d8451c38d..518a72525 100644 --- a/dandiapi/api/tests/factories.py +++ b/dandiapi/api/tests/factories.py @@ -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 @@ -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: diff --git a/dandiapi/api/tests/test_users.py b/dandiapi/api/tests/test_users.py index 8cf494058..4b6e95410 100644 --- a/dandiapi/api/tests/test_users.py +++ b/dandiapi/api/tests/test_users.py @@ -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/', diff --git a/dandiapi/conftest.py b/dandiapi/conftest.py index 79e2ffb2d..f2da055e0 100644 --- a/dandiapi/conftest.py +++ b/dandiapi/conftest.py @@ -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