Skip to content

Commit

Permalink
fix: Storage tests fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
josebui committed Nov 22, 2023
1 parent 827c0db commit 3e97fbf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
12 changes: 8 additions & 4 deletions terraso_backend/tests/storage/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
from mixer.backend.django import mixer

from apps.auth.services import JWTService
from apps.core.models import Group, Landscape, LandscapeGroup, User
from apps.collaboration.models import Membership as CollaborationMembership
from apps.core import landscape_collaboration_roles
from apps.core.models import Landscape, User


@pytest.fixture
Expand All @@ -33,7 +35,9 @@ def user():
@pytest.fixture
def landscape(user):
landscape = mixer.blend(Landscape)
group = mixer.blend(Group)
group.add_manager(user)
mixer.blend(LandscapeGroup, landscape=landscape, group=group, is_default_landscape_group=True)
landscape.membership_list.save_membership(
user.email,
landscape_collaboration_roles.ROLE_MANAGER,
CollaborationMembership.APPROVED,
)
return landscape
4 changes: 3 additions & 1 deletion terraso_backend/tests/storage/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ def test_post_user_profile_image(mock_s3, client, access_token):
assert response.status_code == 200


def test_create_data_entry_successfully(logged_client, landscape_profile_image_payload):
def test_create_landscape_profile_image_successfully(
logged_client, landscape_profile_image_payload
):
url = reverse("terraso_storage:landscape-profile-image")
with patch(
"apps.storage.forms.profile_image_upload_service.upload_file"
Expand Down

0 comments on commit 3e97fbf

Please sign in to comment.