Browse Source

Commit patch from jelte in ticket #156 to
fix boolean tests failure.

Re-enable test.py. It now works:

Running test: test.py
.....................
----------------------------------------------------------------------
Ran 21 tests in 0.002s

OK

This may be fixed a different way, but for now this is a workaround
for the test.
jelte said in jabber: "i know of no code that uses boolean values
in messages right now ... certainly no data specifications"


git-svn-id: svn://bind10.isc.org/svn/bind10/trunk@1765 e5f2f494-b856-4b98-b285-d166d9295462

Jeremy C. Reed 15 years ago
parent
commit
8c61dadda1

+ 2 - 2
src/lib/cc/data.cc

@@ -898,9 +898,9 @@ BoolElement::toWire(std::stringstream& ss,
 {
     ss << encode_length(1, ITEM_BOOL);
     if (boolValue()) {
-        ss << 0x01;
+        ss << '1';
     } else {
-        ss << 0x00;
+        ss << '0';
     }
 }
 

+ 1 - 1
src/lib/python/isc/cc/message.py

@@ -200,7 +200,7 @@ def _decode_item(data):
     return (value, data)
 
 def _decode_bool(data):
-    return data == b'1' or data == b'0x01'
+    return data == b'1'
 
 def _decode_int(data):
     return int(str(data, 'utf-8'))

+ 1 - 5
src/lib/python/isc/cc/tests/Makefile.am

@@ -1,13 +1,9 @@
-# NOTE: test.py remove since is broken. See ticket #156
-PYTESTS = data_test.py session_test.py
+PYTESTS = data_test.py session_test.py test.py
 # NOTE: test_session.py is to be run manually, so not automated.
 EXTRA_DIST = $(PYTESTS)
 EXTRA_DIST += sendcmd.py
 EXTRA_DIST += test_session.py
 
-# TODO: remove this when readded to PYTESTS
-EXTRA_DIST += test.py
-
 # later will have configure option to choose this, like: coverage run --branch
 PYCOVERAGE = $(PYTHON)
 # test using command-line arguments, so use check-local target instead of TESTS

+ 2 - 2
src/lib/python/isc/cc/tests/test.py

@@ -80,11 +80,11 @@ class TestCCWireEncoding(unittest.TestCase):
 
     def test_to_wire_of_bool_true(self):
         wire = isc.cc.message.to_wire({ "bool": True })
-        self.assertEqual(wire, b'Skan\x04bool%\x01\x01')
+        self.assertEqual(wire, b'Skan\x04bool%\x011')
 
     def test_to_wire_of_bool_false(self):
         wire = isc.cc.message.to_wire({ "bool": False })
-        self.assertEqual(wire, b'Skan\x04bool%\x01\x00')
+        self.assertEqual(wire, b'Skan\x04bool%\x010')
 
     def test_from_wire_of_bool_true(self):
         wire = b'Skan\x04bool%\x01\x01'