[checkmk-commits] store: Added test for handling empty file

Lars Michelsen lm at mathias-kettner.de
Thu Sep 29 12:12:55 CEST 2016


Module: check_mk
Branch: master
Commit: f62401fa5be2e596a7bcf6d2929ac3ad72f7d978
URL:    http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f62401fa5be2e596a7bcf6d2929ac3ad72f7d978

Author: Lars Michelsen <lm at mathias-kettner.de>
Date:   Thu Sep 29 08:29:13 2016 +0200

store: Added test for handling empty file

---

 tests/lib/test_store.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tests/lib/test_store.py b/tests/lib/test_store.py
index e5ba7ea..1935991 100644
--- a/tests/lib/test_store.py
+++ b/tests/lib/test_store.py
@@ -17,6 +17,13 @@ def test_load_data_from_file_not_existing(tmpdir):
     assert data == "DEFAULT"
 
 
+def test_load_data_from_file_empty(tmpdir):
+    locked_file = tmpdir.join("test")
+    locked_file.write("")
+    data = store.load_data_from_file("%s/x" % tmpdir, "DEF")
+    assert data == "DEF"
+
+
 def test_load_data_not_locked(tmpdir):
     locked_file = tmpdir.join("locked_file")
     locked_file.write("[1, 2]")



More information about the checkmk-commits mailing list