summaryrefslogtreecommitdiff
path: root/waitress/tests/test_init.py
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2011-12-26 02:21:24 -0500
committerChris McDonough <chrism@plope.com>2011-12-26 02:21:24 -0500
commit680112d3d3d4b33bea015ea691fe98d0975afd20 (patch)
tree02abfedeeb88015759289436db2696e605b36f75 /waitress/tests/test_init.py
parent24a866011f5a907b81313dd7cccd2fba15bd399b (diff)
downloadwaitress-680112d3d3d4b33bea015ea691fe98d0975afd20.tar.gz
add tests for asbool
Diffstat (limited to 'waitress/tests/test_init.py')
-rw-r--r--waitress/tests/test_init.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/waitress/tests/test_init.py b/waitress/tests/test_init.py
index e8369ab..95f2e26 100644
--- a/waitress/tests/test_init.py
+++ b/waitress/tests/test_init.py
@@ -1,5 +1,42 @@
import unittest
+class Test_asbool(unittest.TestCase):
+ def _callFUT(self, s):
+ from waitress import asbool
+ return asbool(s)
+
+ def test_s_is_None(self):
+ result = self._callFUT(None)
+ self.assertEqual(result, False)
+
+ def test_s_is_True(self):
+ result = self._callFUT(True)
+ self.assertEqual(result, True)
+
+ def test_s_is_False(self):
+ result = self._callFUT(False)
+ self.assertEqual(result, False)
+
+ def test_s_is_true(self):
+ result = self._callFUT('True')
+ self.assertEqual(result, True)
+
+ def test_s_is_false(self):
+ result = self._callFUT('False')
+ self.assertEqual(result, False)
+
+ def test_s_is_yes(self):
+ result = self._callFUT('yes')
+ self.assertEqual(result, True)
+
+ def test_s_is_on(self):
+ result = self._callFUT('on')
+ self.assertEqual(result, True)
+
+ def test_s_is_1(self):
+ result = self._callFUT(1)
+ self.assertEqual(result, True)
+
class Test_serve(unittest.TestCase):
def _callFUT(self, app, **kw):
from waitress import serve