From e955b75041bba10784232ebce7b8cf8beaa58657 Mon Sep 17 00:00:00 2001
From: Matthias <matthias.mair@oewf.org>
Date: Fri, 11 Mar 2022 23:41:30 +0100
Subject: [PATCH] test restart flag reset

---
 InvenTree/common/tests.py | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/InvenTree/common/tests.py b/InvenTree/common/tests.py
index 1dd5bc03bc..1a51638c21 100644
--- a/InvenTree/common/tests.py
+++ b/InvenTree/common/tests.py
@@ -223,3 +223,26 @@ class NotificationTest(TestCase):
         self.assertFalse(NotificationEntry.check_recent('test.notification2', 1, delta))
 
         self.assertTrue(NotificationEntry.check_recent('test.notification', 1, delta))
+
+
+class LoadingTest(TestCase):
+    """
+    Tests for the common config
+    """
+
+    def test_restart_flag(self):
+        """
+        Test that the restart flag is reset on start
+        """
+
+        import common.models
+        from plugin import registry
+
+        # set flag true
+        common.models.InvenTreeSetting.set_setting('SERVER_RESTART_REQUIRED', False, None)
+
+        # reload the app
+        registry.reload_plugins()
+
+        # now it should be false again
+        self.assertFalse(common.models.InvenTreeSetting.get_setting('SERVER_RESTART_REQUIRED'))