Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Change AppJob.name to AppJob.app_name

Maciej Korycinskic31988a03e0b
diff --git a/saleor/app/installation_utils.py b/saleor/app/installation_utils.py
index 4c2cdba976..04e89a4c18 100644
--- a/saleor/app/installation_utils.py
+++ b/saleor/app/installation_utils.py
@@ -41,7 +41,7 @@ def install_app(
validate_manifest_fields(manifest_data)
app = App.objects.create(
- name=app_job.name,
+ name=app_job.app_name,
is_active=activate,
identificator=manifest_data.get("identificator"),
about_app=manifest_data.get("about_app"),
diff --git a/saleor/app/migrations/0002_auto_20200512_0314.py b/saleor/app/migrations/0002_auto_20200514_0635.py
similarity index 97%
rename from saleor/app/migrations/0002_auto_20200512_0314.py
rename to saleor/app/migrations/0002_auto_20200514_0635.py
index 4826a2ee6b..0664157a92 100644
--- a/saleor/app/migrations/0002_auto_20200512_0314.py
+++ b/saleor/app/migrations/0002_auto_20200514_0635.py
@@ -1,4 +1,4 @@
-# Generated by Django 3.0.6 on 2020-05-12 08:14
+# Generated by Django 3.0.6 on 2020-05-14 11:35
from django.db import migrations, models
@@ -93,7 +93,7 @@ class Migration(migrations.Migration):
("message", models.CharField(blank=True, max_length=255, null=True)),
("created_at", models.DateTimeField(auto_now_add=True)),
("updated_at", models.DateTimeField(auto_now=True)),
- ("name", models.CharField(max_length=60)),
+ ("app_name", models.CharField(max_length=60)),
("manifest_url", models.URLField()),
(
"permissions",
diff --git a/saleor/app/models.py b/saleor/app/models.py
index a76d12b609..d5c90c3734 100644
--- a/saleor/app/models.py
+++ b/saleor/app/models.py
@@ -77,7 +77,7 @@ class AppToken(models.Model):
class AppJob(Job):
- name = models.CharField(max_length=60)
+ app_name = models.CharField(max_length=60)
manifest_url = models.URLField()
permissions = models.ManyToManyField(
Permission,
diff --git a/saleor/graphql/app/mutations.py b/saleor/graphql/app/mutations.py
index 20f86ebfa4..c05b696cc0 100644
--- a/saleor/graphql/app/mutations.py
+++ b/saleor/graphql/app/mutations.py
@@ -287,7 +287,7 @@ class AppRetryInstall(ModelMutation):
class AppInstallInput(graphene.InputObjectType):
- name = graphene.String(description="Name of the app to install.")
+ app_name = graphene.String(description="Name of the app to install.")
manifest_url = graphene.String(description="Url to app's manifest in JSON format.")
activate_after_installation = graphene.Boolean(
default_value=True,
diff --git a/saleor/graphql/app/types.py b/saleor/graphql/app/types.py
index 5537c27fff..09cf3cdc8a 100644
--- a/saleor/graphql/app/types.py
+++ b/saleor/graphql/app/types.py
@@ -117,7 +117,7 @@ class AppOngoingInstallation(CountableDjangoObjectType):
"status",
"created_at",
"updated_at",
- "name",
+ "app_name",
"manifest_url",
"message",
]
diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphql
index fbc6590df9..f07036104d 100644
--- a/saleor/graphql/schema.graphql
+++ b/saleor/graphql/schema.graphql
@@ -279,7 +279,7 @@ type AppInstall {
}
input AppInstallInput {
- name: String
+ appName: String
manifestUrl: String
activateAfterInstallation: Boolean = true
permissions: [PermissionEnum]
@@ -298,7 +298,7 @@ type AppOngoingInstallation {
message: String
createdAt: DateTime!
updatedAt: DateTime!
- name: String!
+ appName: String!
manifestUrl: String!
}
diff --git a/tests/api/app/mutations/test_app_install.py b/tests/api/app/mutations/test_app_install.py
index 9dc5722029..3bfa1bf354 100644
--- a/tests/api/app/mutations/test_app_install.py
+++ b/tests/api/app/mutations/test_app_install.py
@@ -8,13 +8,14 @@ from ...utils import get_graphql_content
INSTALL_APP_MUTATION = """
mutation AppInstall(
- $name: String, $manifest_url: String, $permissions: [PermissionEnum]){
+ $app_name: String, $manifest_url: String, $permissions: [PermissionEnum]){
appInstall(
- input:{name: $name, manifestUrl: $manifest_url, permissions:$permissions}){
+ input:{appName: $app_name, manifestUrl: $manifest_url,
+ permissions:$permissions}){
appJob{
id
status
- name
+ appName
manifestUrl
}
appErrors{
@@ -42,7 +43,7 @@ def test_install_app_mutation(
query = INSTALL_APP_MUTATION
staff_user.user_permissions.set([permission_manage_apps, permission_manage_orders])
variables = {
- "name": "New external integration",
+ "app_name": "New external integration",
"manifest_url": "http://localhost:3000/manifest",
"permissions": [PermissionEnum.MANAGE_ORDERS.name],
}
@@ -68,7 +69,7 @@ def test_install_app_mutation_by_app(
[permission_manage_apps, permission_manage_orders]
)
variables = {
- "name": "New external integration",
+ "app_name": "New external integration",
"manifest_url": "http://localhost:3000/manifest",
"permissions": [PermissionEnum.MANAGE_ORDERS.name],
}
@@ -88,7 +89,7 @@ def test_app_install_mutation_out_of_scope_permissions(
query = INSTALL_APP_MUTATION
staff_user.user_permissions.set([permission_manage_apps])
variables = {
- "name": "New external integration",
+ "app_name": "New external integration",
"manifest_url": "http://localhost:3000/manifest",
"permissions": [PermissionEnum.MANAGE_ORDERS.name],
}
@@ -111,7 +112,7 @@ def test_install_app_mutation_by_app_out_of_scope_permissions(
query = INSTALL_APP_MUTATION
app_api_client.app.permissions.set([permission_manage_apps])
variables = {
- "name": "New external integration",
+ "app_name": "New external integration",
"manifest_url": "http://localhost:3000/manifest",
"permissions": [PermissionEnum.MANAGE_ORDERS.name],
}
diff --git a/tests/api/app/mutations/test_app_retry_install.py b/tests/api/app/mutations/test_app_retry_install.py
index 111cd7948a..ae769c09cb 100644
--- a/tests/api/app/mutations/test_app_retry_install.py
+++ b/tests/api/app/mutations/test_app_retry_install.py
@@ -14,7 +14,7 @@ RETRY_INSTALL_APP_MUTATION = """
appJob{
id
status
- name
+ appName
manifestUrl
}
appErrors{
diff --git a/tests/conftest.py b/tests/conftest.py
index ea3bd3066f..dd98e22129 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -2178,6 +2178,6 @@ def allocations(order_list, stock):
@pytest.fixture
def app_job():
app_job = AppJob.objects.create(
- name="External App", manifest_url="http://localhost:3000/manifest",
+ app_name="External App", manifest_url="http://localhost:3000/manifest",
)
return app_job
diff --git a/tests/test_app_tasks.py b/tests/test_app_tasks.py
index fb7154e485..d748c19c87 100644
--- a/tests/test_app_tasks.py
+++ b/tests/test_app_tasks.py
@@ -12,7 +12,7 @@ from saleor.core import JobStatus
def test_install_app_task(app_job):
install_app_task(app_job.id, activate=False)
assert not AppJob.objects.all().exists()
- app = App.objects.filter(name=app_job.name).first()
+ app = App.objects.filter(name=app_job.app_name).first()
assert app
assert app.is_active is False
@@ -20,7 +20,7 @@ def test_install_app_task(app_job):
@pytest.mark.vcr
def test_install_app_task_wrong_format_of_target_token_url():
app_job = AppJob.objects.create(
- name="External App", manifest_url="http://localhost:3000/manifest-wrong",
+ app_name="External App", manifest_url="http://localhost:3000/manifest-wrong",
)
install_app_task(app_job.id, activate=False)
app_job.refresh_from_db()
@@ -47,7 +47,7 @@ def test_install_app_task_request_timeout(monkeypatch, app_job):
@pytest.mark.vcr
def test_install_app_task_wrong_response_code(monkeypatch, app_job):
app_job = AppJob.objects.create(
- name="External App", manifest_url="http://localhost:3000/manifest-wrong1",
+ app_name="External App", manifest_url="http://localhost:3000/manifest-wrong1",
)
mocked_post = Mock()
mocked_post.status_code = 404