]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
Add test case for boolean.
authorAngus Salkeld <asalkeld@redhat.com>
Tue, 24 Apr 2012 00:32:58 +0000 (10:32 +1000)
committerAngus Salkeld <asalkeld@redhat.com>
Tue, 24 Apr 2012 00:32:58 +0000 (10:32 +1000)
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
heat/tests/test_cfn.py

index 025d6030f570bdf1a11fedb2a8f3880184cc417c..41df2d2811994e6b49473fcc051ee2f01674bbf5 100644 (file)
@@ -13,6 +13,32 @@ from nose import with_setup
 from heat.cfntools.cfn_helper import *
 
 
+@attr(tag=['cfn_helper'])
+@attr(speed='fast')
+def test_boolean():
+
+    assert(to_boolean('true'))
+    assert(to_boolean(True))
+    assert(to_boolean('TRUE'))
+    assert(to_boolean('True'))
+    assert(to_boolean('Yes'))
+    assert(to_boolean('YES'))
+    assert(to_boolean('yes'))
+    assert(to_boolean('1'))
+    assert(to_boolean(1))
+
+    assert(not to_boolean('tru'))
+    assert(not to_boolean(False))
+    assert(not to_boolean('False'))
+    assert(not to_boolean('FALSE'))
+    assert(not to_boolean('No'))
+    assert(not to_boolean('NO'))
+    assert(not to_boolean('no'))
+    assert(not to_boolean('0334'))
+    assert(not to_boolean(0))
+    assert(not to_boolean(56))
+
+
 @attr(tag=['cfn-hup'])
 @attr(speed='fast')
 def test_hup_conf1():