Skip to content

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

Change default value of PluginConfiguration active field to False

IKarbowiak49a1ecdc7bf1
diff --git a/saleor/plugins/avatax/tests/test_avatax.py b/saleor/plugins/avatax/tests/test_avatax.py
index 05d8c0734a..8fce5065d4 100644
--- a/saleor/plugins/avatax/tests/test_avatax.py
+++ b/saleor/plugins/avatax/tests/test_avatax.py
@@ -484,6 +484,7 @@ def test_save_plugin_configuration(api_get_request_mock, settings):
manager.save_plugin_configuration(
AvataxPlugin.PLUGIN_ID,
{
+ "active": True,
"configuration": [
{"name": "Username or account", "value": "test"},
{"name": "Password or license", "value": "test"},
@@ -511,16 +512,20 @@ def test_save_plugin_configuration_authentication_failed(
manager.save_plugin_configuration(
AvataxPlugin.PLUGIN_ID,
{
+ "active": True,
"configuration": [
{"name": "Username or account", "value": "test"},
{"name": "Password or license", "value": "test"},
- {"name": "Active", "value": True},
],
},
)
# then
assert e._excinfo[1].args[0] == "Authentication failed. Please check provided data."
+ plugin_configuration = PluginConfiguration.objects.get(
+ identifier=AvataxPlugin.PLUGIN_ID
+ )
+ assert not plugin_configuration.active
def test_save_plugin_configuration_cannot_be_enabled_without_config(
diff --git a/saleor/plugins/migrations/0006_auto_20200909_1253.py b/saleor/plugins/migrations/0006_auto_20200909_1253.py
new file mode 100644
index 0000000000..3bc8d5ca2f
--- /dev/null
+++ b/saleor/plugins/migrations/0006_auto_20200909_1253.py
@@ -0,0 +1,18 @@
+# Generated by Django 3.1 on 2020-09-09 12:53
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ("plugins", "0005_auto_20200810_1415"),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name="pluginconfiguration",
+ name="active",
+ field=models.BooleanField(default=False),
+ ),
+ ]
diff --git a/saleor/plugins/models.py b/saleor/plugins/models.py
index 6fca708e26..68ef74de22 100644
--- a/saleor/plugins/models.py
+++ b/saleor/plugins/models.py
@@ -9,7 +9,7 @@ class PluginConfiguration(models.Model):
identifier = models.CharField(max_length=128, unique=True)
name = models.CharField(max_length=128)
description = models.TextField(blank=True)
- active = models.BooleanField(default=True)
+ active = models.BooleanField(default=False)
configuration = JSONField(
blank=True, null=True, default=dict, encoder=CustomJsonEncoder
)