From d4a77454e73ed472a5a892e203fc671ba6cd6598 Mon Sep 17 00:00:00 2001
From: Alex Knaust <awknaust@gmail.com>
Date: Sat, 27 Sep 2014 18:13:01 -0600
Subject: [PATCH] Added test case for overwriting null config values

---
 deluge/tests/test_config.py | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/deluge/tests/test_config.py b/deluge/tests/test_config.py
index 5fa4d15..587bd4c 100644
--- a/deluge/tests/test_config.py
+++ b/deluge/tests/test_config.py
@@ -43,6 +43,26 @@ def test_set_get_item(self):
         self.assertTrue(isinstance(config.get_item("unicode"), unicode))
 
         config._save_timer.cancel()
+   
+    def test_set_get_overwrite_null(self):
+        config = Config("test.conf", config_dir=self.config_dir)
+        
+        #We should be able to overwrite a null config value with a real one
+        config["foo"] = None
+        self.assertIsNone(config["foo"])
+        self.assertIsInstance(config["foo"], type(None))
+
+        config["foo"] = 1
+        self.assertEquals(config.get("foo"), 1)
+        self.assertIsInstance(config.get("foo"), type(1))
+
+        #Should also be possible
+        config["bar"] = None
+        self.assertIsNone(config["bar"])
+        config["bar"] = None
+        self.assertIsNone(config["bar"])
+
+        config._save_timer.cancel()
 
     def test_get(self):
         config = Config("test.conf", config_dir=self.config_dir)
-- 
1.9.1

