Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Change app manifest fields to camelCase
Maciej Korycinski439e22ad60c9
diff --git a/saleor/app/app_manifest_sample.json b/saleor/app/app_manifest_sample.jsonindex 98be673b9b..12e46b11b4 100644--- a/saleor/app/app_manifest_sample.json+++ b/saleor/app/app_manifest_sample.json@@ -1,13 +1,14 @@{- "name": "app",- "version": "1.0.0",- "about_app": "Lorem ipsum",- "data_privacy": "Lorem ipsum",- "data_privacy_url": "http://localhost:3000/app-data-privacy",- "homepage_url": "http://localhost:3000/homepage",- "support_url": "http://localhost:3000/support",- "configuration_url": "htpp://localhost:3000/configuration",- "app_url": "http://localhost:3000/app",- "token_target_url": "http://localhost:3000/register",- "identificator": "saleor.app.sample",+ "id": "saleor.app.sample",+ "version": "1.0.0",+ "name": "My Wonderful App",+ "about": "My Wonderful App is a wonderful App for Saleor.",+ "permissions": ["MANAGE_USERS", "MANAGE_STAFF"],+ "appUrl": "http://localhost:3000/app",+ "configurationUrl": "htpp://localhost:3000/configuration",+ "tokenTargetUrl": "http://localhost:3000/register",+ "dataPrivacy": "Lorem ipsum",+ "dataPrivacyUrl": "http://localhost:3000/app-data-privacy",+ "homepageUrl": "http://localhost:3000/homepage",+ "supportUrl": "http://localhost:3000/support"}diff --git a/saleor/app/installation_utils.py b/saleor/app/installation_utils.pyindex 01d59d8e6c..1ab891f48c 100644--- a/saleor/app/installation_utils.py+++ b/saleor/app/installation_utils.py@@ -21,13 +21,13 @@ def send_app_token(target_url: str, token: str):def validate_manifest_fields(manifest_data):- token_target_url = manifest_data.get("token_target_url")+ token_target_url = manifest_data.get("tokenTargetUrl")try:url_validator = URLValidator()url_validator(token_target_url)except ValidationError:- raise ValidationError({"token_target_url": "Incorrect format."})+ raise ValidationError({"tokenTargetUrl": "Incorrect format."})@transaction.atomic@@ -43,20 +43,20 @@ def install_app(app = App.objects.create(name=app_installation.app_name,is_active=activate,- identificator=manifest_data.get("identificator"),- about_app=manifest_data.get("about_app"),- data_privacy=manifest_data.get("data_privacy"),- data_privacy_url=manifest_data.get("data_privacy_url"),- homepage_url=manifest_data.get("homepage_url"),- support_url=manifest_data.get("support_url"),- configuration_url=manifest_data.get("configuration_url"),- app_url=manifest_data.get("app_url"),+ identifier=manifest_data.get("id"),+ about_app=manifest_data.get("aboutApp"),+ data_privacy=manifest_data.get("dataPrivacy"),+ data_privacy_url=manifest_data.get("dataPrivacyUrl"),+ homepage_url=manifest_data.get("homepageUrl"),+ support_url=manifest_data.get("supportUrl"),+ configuration_url=manifest_data.get("configurationUrl"),+ app_url=manifest_data.get("appUrl"),version=manifest_data.get("version"),type=AppType.EXTERNAL,)app.permissions.set(app_installation.permissions.all())token = app.tokens.create(name="Default token")send_app_token(- target_url=manifest_data.get("token_target_url"), token=token.auth_token+ target_url=manifest_data.get("tokenTargetUrl"), token=token.auth_token)return appdiff --git a/saleor/app/migrations/0002_auto_20200519_0838.py b/saleor/app/migrations/0002_auto_20200520_0124.pysimilarity index 97%rename from saleor/app/migrations/0002_auto_20200519_0838.pyrename to saleor/app/migrations/0002_auto_20200520_0124.pyindex 2e6fee8f8d..930324f93a 100644--- a/saleor/app/migrations/0002_auto_20200519_0838.py+++ b/saleor/app/migrations/0002_auto_20200520_0124.py@@ -1,4 +1,4 @@-# Generated by Django 3.0.6 on 2020-05-19 13:38+# Generated by Django 3.0.6 on 2020-05-20 06:24from django.db import migrations, models@@ -43,7 +43,7 @@ class Migration(migrations.Migration):),migrations.AddField(model_name="app",- name="identificator",+ name="identifier",field=models.CharField(blank=True, max_length=256, null=True),),migrations.AddField(diff --git a/saleor/app/models.py b/saleor/app/models.pyindex a8d3894cb4..6e8a7721f5 100644--- a/saleor/app/models.py+++ b/saleor/app/models.py@@ -16,7 +16,7 @@ class App(ModelWithMetadata):type = models.CharField(choices=AppType.CHOICES, default=AppType.CUSTOM, max_length=60)- identificator = models.CharField(blank=True, null=True, max_length=256)+ identifier = models.CharField(blank=True, null=True, max_length=256)permissions = models.ManyToManyField(Permission,blank=True,diff --git a/tests/cassettes/test_install_app_task.yaml b/tests/cassettes/test_install_app_task.yamlindex 2bb0b83361..ca5570ee68 100644--- a/tests/cassettes/test_install_app_task.yaml+++ b/tests/cassettes/test_install_app_task.yaml@@ -14,13 +14,14 @@ interactions:uri: http://localhost:3000/manifestresponse:body:- string: "{\n \"name\": \"app\",\n \"version\": \"1.0.0\",\n \"about_app\"\- : \"Lorem ipsum\",\n \"data_privacy\": \"Lorem ipsum\",\n \"data_privacy_url\"\- : \"http://localhost:8888/app-data-privacy\",\n \"homepage_url\": \"http://localhost:8888/homepage\"\- ,\n \"support_url\": \"http://localhost:8888/support\",\n \"configuration_url\"\- : \"htpp://localhost:8888/configuration\",\n \"app_url\": \"http://localhost:8888/app\"\- ,\n \"token_target_url\": \"http://localhost:3000/register\",\n \"identificator\"\- : \"app1\"\n}"+ string: "{\n \"name\": \"app\",\n \"version\": \"1.0.0\",\n \"aboutApp\"\+ : \"Lorem ipsum\",\n \"dataPrivacy\": \"Lorem ipsum\",\n \"dataPrivacyUrl\"\+ : \"http://localhost:8888/app-data-privacy\",\n \"homepageUrl\": \"http://localhost:8888/homepage\"\+ ,\n \"supportUrl\": \"http://localhost:8888/support\",\n \"configurationUrl\"\+ : \"htpp://localhost:8888/configuration\",\n \"appUrl\": \"http://localhost:8888/app\"\+ ,\n \"tokenTargetUrl\": \"http://localhost:3000/register\",\n \"id\": \"\+ app2\",\n \"permissions\": [\n \"MANAGE_USERS\",\n \"MANAGE_ORDERS\"\+ \n ]\n}"headers:Access-Control-Allow-Credentials:- 'true'@@ -29,13 +30,13 @@ interactions:Connection:- keep-aliveContent-Length:- - '457'+ - '500'Content-Type:- application/json; charset=utf-8Date:- - Thu, 07 May 2020 07:55:46 GMT+ - Wed, 20 May 2020 06:37:09 GMTETag:- - W/"1c9-8xRk1lVv4obFp1NpaAqOhbFNhyU"+ - W/"1f4-qx17e+bDbZJtTZiNJJshOoM1U6s"Expires:- '-1'Pragma:@@ -50,7 +51,7 @@ interactions:code: 200message: OK- request:- body: '{"auth_token": "WeYRSINjjQV3IEcJVgk0IE7OxeoLuj"}'+ body: '{"auth_token": "LaV7FNJZJ905sZsEIYv5Bl2E7iDbZE"}'headers:Accept:- '*/*'@@ -70,8 +71,8 @@ interactions:uri: http://localhost:3000/registerresponse:body:- string: "{\n \"auth_token\": \"WeYRSINjjQV3IEcJVgk0IE7OxeoLuj\",\n \"id\"\- : 8\n}"+ string: "{\n \"auth_token\": \"LaV7FNJZJ905sZsEIYv5Bl2E7iDbZE\",\n \"id\"\+ : 32\n}"headers:Access-Control-Allow-Credentials:- 'true'@@ -82,17 +83,17 @@ interactions:Connection:- keep-aliveContent-Length:- - '63'+ - '64'Content-Type:- application/json; charset=utf-8Date:- - Thu, 07 May 2020 07:55:46 GMT+ - Wed, 20 May 2020 06:37:09 GMTETag:- - W/"3f-rrHlPsVQDlQJanMe/Ngzy/3zZao"+ - W/"40-gxR1s/QM60VMIWkmNp6bmY5LYbo"Expires:- '-1'Location:- - http://localhost:3000/register/8+ - http://localhost:3000/register/32Pragma:- no-cacheVary:diff --git a/tests/cassettes/test_install_app_task_request_timeout.yaml b/tests/cassettes/test_install_app_task_request_timeout.yamlindex e5725928eb..a45704fab9 100644--- a/tests/cassettes/test_install_app_task_request_timeout.yaml+++ b/tests/cassettes/test_install_app_task_request_timeout.yaml@@ -14,13 +14,14 @@ interactions:uri: http://localhost:3000/manifestresponse:body:- string: "{\n \"name\": \"app\",\n \"version\": \"1.0.0\",\n \"about_app\"\- : \"Lorem ipsum\",\n \"data_privacy\": \"Lorem ipsum\",\n \"data_privacy_url\"\- : \"http://localhost:8888/app-data-privacy\",\n \"homepage_url\": \"http://localhost:8888/homepage\"\- ,\n \"support_url\": \"http://localhost:8888/support\",\n \"configuration_url\"\- : \"htpp://localhost:8888/configuration\",\n \"app_url\": \"http://localhost:8888/app\"\- ,\n \"token_target_url\": \"http://localhost:3000/register\",\n \"identificator\"\- : \"app1\"\n}"+ string: "{\n \"name\": \"app\",\n \"version\": \"1.0.0\",\n \"aboutApp\"\+ : \"Lorem ipsum\",\n \"dataPrivacy\": \"Lorem ipsum\",\n \"dataPrivacyUrl\"\+ : \"http://localhost:8888/app-data-privacy\",\n \"homepageUrl\": \"http://localhost:8888/homepage\"\+ ,\n \"supportUrl\": \"http://localhost:8888/support\",\n \"configurationUrl\"\+ : \"htpp://localhost:8888/configuration\",\n \"appUrl\": \"http://localhost:8888/app\"\+ ,\n \"tokenTargetUrl\": \"http://localhost:3000/register\",\n \"id\": \"\+ app2\",\n \"permissions\": [\n \"MANAGE_USERS\",\n \"MANAGE_ORDERS\"\+ \n ]\n}"headers:Access-Control-Allow-Credentials:- 'true'@@ -29,13 +30,13 @@ interactions:Connection:- keep-aliveContent-Length:- - '457'+ - '500'Content-Type:- application/json; charset=utf-8Date:- - Thu, 07 May 2020 08:49:14 GMT+ - Wed, 20 May 2020 06:37:16 GMTETag:- - W/"1c9-8xRk1lVv4obFp1NpaAqOhbFNhyU"+ - W/"1f4-qx17e+bDbZJtTZiNJJshOoM1U6s"Expires:- '-1'Pragma:diff --git a/tests/cassettes/test_install_app_task_wrong_format_of_target_token_url.yaml b/tests/cassettes/test_install_app_task_wrong_format_of_target_token_url.yamlindex af98ca7b24..7bf82ed4cf 100644--- a/tests/cassettes/test_install_app_task_wrong_format_of_target_token_url.yaml+++ b/tests/cassettes/test_install_app_task_wrong_format_of_target_token_url.yaml@@ -14,13 +14,12 @@ interactions:uri: http://localhost:3000/manifest-wrongresponse:body:- string: "{\n \"name\": \"app\",\n \"version\": \"1.0.0\",\n \"about_app\"\- : \"Lorem ipsum\",\n \"data_privacy\": \"Lorem ipsum\",\n \"data_privacy_url\"\- : \"http://localhost:8888/app-data-privacy\",\n \"homepage_url\": \"http://localhost:8888/homepage\"\- ,\n \"support_url\": \"http://localhost:8888/support\",\n \"configuration_url\"\- : \"htpp://localhost:8888/configuration\",\n \"app_url\": \"http://localhost:8888/app\"\- ,\n \"token_target_url\": \"register-wrong-format\",\n \"identificator\"\- : \"app2\"\n}"+ string: "{\n \"name\": \"app\",\n \"version\": \"1.0.0\",\n \"aboutApp\"\+ : \"Lorem ipsum\",\n \"dataPrivacy\": \"Lorem ipsum\",\n \"dataPrivacyUrl\"\+ : \"http://localhost:8888/app-data-privacy\",\n \"homepageUrl\": \"http://localhost:8888/homepage\"\+ ,\n \"supportUrl\": \"http://localhost:8888/support\",\n \"configurationUrl\"\+ : \"htpp://localhost:8888/configuration\",\n \"appUrl\": \"http://localhost:8888/app\"\+ ,\n \"tokenTargetUrl\": \"register-wrong-format\",\n \"id\": \"app2\"\n}"headers:Access-Control-Allow-Credentials:- 'true'@@ -29,13 +28,13 @@ interactions:Connection:- keep-aliveContent-Length:- - '448'+ - '427'Content-Type:- application/json; charset=utf-8Date:- - Thu, 07 May 2020 08:21:20 GMT+ - Wed, 20 May 2020 06:37:15 GMTETag:- - W/"1c0-JJiYGAsB1lIohC/29ugFSHRYbSM"+ - W/"1ab-ApGXdwifw96yQqDaesbw4RlSkIQ"Expires:- '-1'Pragma:diff --git a/tests/cassettes/test_install_app_task_wrong_response_code.yaml b/tests/cassettes/test_install_app_task_wrong_response_code.yamlindex 74f30be6ea..ba0ade9fbd 100644--- a/tests/cassettes/test_install_app_task_wrong_response_code.yaml+++ b/tests/cassettes/test_install_app_task_wrong_response_code.yaml@@ -27,7 +27,7 @@ interactions:Content-Type:- application/json; charset=utf-8Date:- - Thu, 07 May 2020 09:49:45 GMT+ - Wed, 20 May 2020 06:37:16 GMTETag:- W/"2-vyGp6PvFo4RvsFtPoIWeCReyIC8"Expires:diff --git a/tests/conftest.py b/tests/conftest.pyindex 8774209bfb..1167540ec2 100644--- a/tests/conftest.py+++ b/tests/conftest.py@@ -1980,7 +1980,7 @@ def external_app(db):name="External App",is_active=True,type=AppType.EXTERNAL,- identificator="mirumee.app.sample",+ identifier="mirumee.app.sample",about_app="About app text.",data_privacy="Data privacy text.",data_privacy_url="http://www.example.com/privacy/",diff --git a/tests/test_app_tasks.py b/tests/test_app_tasks.pyindex 8fea437367..78a2a67f4c 100644--- a/tests/test_app_tasks.py+++ b/tests/test_app_tasks.py@@ -25,7 +25,7 @@ def test_install_app_task_wrong_format_of_target_token_url():install_app_task(app_installation.id, activate=False)app_installation.refresh_from_db()assert app_installation.status == JobStatus.FAILED- assert app_installation.message == "token_target_url: ['Incorrect format.']"+ assert app_installation.message == "tokenTargetUrl: ['Incorrect format.']"assert not App.objects.all()