Browse Source

Added 2 new tests to test-settings.py\n - test_check_open_settings\n - test_check_settings_manager_singleton

Vsevolod Levitan 1 year ago
parent
commit
7dbefbdd64
1 changed files with 29 additions and 1 deletions
  1. 29 1
      test-settings.py

+ 29 - 1
test-settings.py

@@ -1,4 +1,5 @@
 from settings import settings
+import settings_manager
 import unittest
 
 
@@ -16,4 +17,31 @@ class test_settings(unittest.TestCase):
         item.first_name = "a  "
         
         # Проверка
-        assert item.first_name == "a"
+        assert item.first_name == "a"
+
+    #
+    # Проверить, что settings_manager инстанциируется только один раз
+    #
+    def test_check_settings_manager_singleton(self):
+        # Подготовка
+        a = settings_manager()
+        b = settings_manager()
+
+        # Действие
+
+        # Проверка
+        assert a is b
+
+    
+    #
+    # Проверить корректность загрузки настроек
+    #
+    def test_check_open_settings(self):
+        # Подготовка
+        item = settings_manager()
+        
+        # Действие
+        result = item.open("settings.json")
+
+        # Проверка
+        assert result == True