Skip to content

Commit bea13ff

Browse files
fix(migrations): fix django migration order dependency (#6303)
Co-authored-by: Víctor Fernández Poyatos <[email protected]>
1 parent ec0aa9f commit bea13ff

File tree

4 files changed

+7
-16
lines changed

4 files changed

+7
-16
lines changed

api/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.12-alpine AS build
1+
FROM python:3.12.8-alpine3.20 AS build
22

33
LABEL maintainer="https://github.com/prowler-cloud/api"
44

api/src/backend/api/migrations/0005_update_provider_unique_constraint_with_is_deleted.py api/src/backend/api/migrations/0003_update_provider_unique_constraint_with_is_deleted.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
class Migration(migrations.Migration):
77
dependencies = [
8-
("api", "0004_rbac_missing_admin_roles"),
8+
("api", "0002_token_migrations"),
99
]
1010

1111
operations = [

api/src/backend/api/tests/integration/test_authentication.py

+4-14
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
from unittest.mock import patch
2+
13
import pytest
24
from conftest import TEST_PASSWORD, get_api_tokens, get_authorization_header
35
from django.urls import reverse
4-
from unittest.mock import patch
56
from rest_framework.test import APIClient
67

78

@@ -99,12 +100,11 @@ def test_refresh_token(create_test_user, tenants_fixture):
99100
assert new_refresh_response.status_code == 200
100101

101102

103+
@patch("api.db_router.MainRouter.admin_db", new="default")
102104
@pytest.mark.django_db
103-
def test_user_me_when_inviting_users(create_test_user, tenants_fixture, roles_fixture):
105+
def test_user_me_when_inviting_users(create_test_user, tenants_fixture):
104106
client = APIClient()
105107

106-
role = roles_fixture[0]
107-
108108
user1_email = "[email protected]"
109109
user2_email = "[email protected]"
110110

@@ -135,16 +135,6 @@ def test_user_me_when_inviting_users(create_test_user, tenants_fixture, roles_fi
135135
"data": {
136136
"type": "invitations",
137137
"attributes": {"email": user2_email},
138-
"relationships": {
139-
"roles": {
140-
"data": [
141-
{
142-
"type": "roles",
143-
"id": str(role.id),
144-
}
145-
]
146-
}
147-
},
148138
}
149139
},
150140
format="vnd.api+json",

api/src/backend/api/tests/integration/test_providers.py

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from api.models import Provider
99

1010

11+
@patch("api.db_router.MainRouter.admin_db", new="default")
1112
@patch("api.v1.views.Task.objects.get")
1213
@patch("api.v1.views.delete_provider_task.delay")
1314
@pytest.mark.django_db

0 commit comments

Comments
 (0)