From 22e3487b9e0720f864feef6cf06238e9af82aa7d Mon Sep 17 00:00:00 2001
From: Brian Warner <warner@lothar.com>
Date: Wed, 31 Oct 2007 00:54:42 -0700
Subject: [PATCH] test_node.py: improve test coverage of node.py

---
 src/allmydata/test/test_node.py | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/src/allmydata/test/test_node.py b/src/allmydata/test/test_node.py
index 9877a159..f55e99a1 100644
--- a/src/allmydata/test/test_node.py
+++ b/src/allmydata/test/test_node.py
@@ -1,11 +1,12 @@
 
+import time
 from twisted.trial import unittest
 from twisted.internet import defer
 from twisted.python import log
 
 from foolscap.eventual import flushEventualQueue
 from twisted.application import service
-from allmydata.node import Node
+from allmydata.node import Node, formatTimeTahoeStyle
 from allmydata.util import testutil
 
 class LoggingMultiService(service.MultiService):
@@ -40,3 +41,18 @@ class TestCase(unittest.TestCase, testutil.SignalMixin):
         d.addCallback(_check_addresses)
         return d
 
+    def test_log(self):
+        n = TestNode()
+        n.log("this is a message")
+        n.log("with %d %s %s", args=(2, "interpolated", "parameters"))
+
+    def test_timestamp(self):
+        # this modified logger doesn't seem to get used during the tests,
+        # probably because we don't modify the LogObserver that trial
+        # installs (only the one that twistd installs). So manually exercise
+        # it a little bit.
+        t = formatTimeTahoeStyle("ignored", time.time())
+        self.failUnless("Z" in t)
+        t2 = formatTimeTahoeStyle("ignored", int(time.time()))
+        self.failUnless("Z" in t2)
+
-- 
2.45.2