From 7d58db4336b29b7def1f02aeb75262ad836bb558 Mon Sep 17 00:00:00 2001 From: Matthias Date: Wed, 2 Mar 2022 22:52:14 +0100 Subject: [PATCH] full set again --- InvenTree/InvenTree/tests.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/InvenTree/InvenTree/tests.py b/InvenTree/InvenTree/tests.py index 5a21cbc87b..53e8bdb618 100644 --- a/InvenTree/InvenTree/tests.py +++ b/InvenTree/InvenTree/tests.py @@ -24,6 +24,7 @@ import InvenTree.tasks from stock.models import StockLocation from common.settings import currency_codes +from plugin.helpers import IntegrationPluginError class ValidatorTest(TestCase): @@ -443,5 +444,20 @@ class TestSettings(TestCase): self.run_reload() self.assertEqual(user_count(), 0) + # enough set + self.env.set('INVENTREE_ADMIN_USER', 'admin') # set username + self.env.set('INVENTREE_ADMIN_EMAIL', 'info@example.com') # set email + self.env.set('INVENTREE_ADMIN_PASSWORD', 'password123') # set password + self.run_reload() + self.assertEqual(user_count(), 1) + + # double adding should not work + self.env.set('INVENTREE_ADMIN_USER', 'admin') # set username + self.env.set('INVENTREE_ADMIN_EMAIL', 'info@example.com') # set email + self.env.set('INVENTREE_ADMIN_PASSWORD', 'password123') # set password + with self.assertRaises(IntegrationPluginError): + self.run_reload() + self.assertEqual(user_count(), 1) + # make sure to clean up settings.TESTING_ENV = False