class MongoDb: database = String() encryption = Boolean() encryptionKey = String() password = String() replicaSet = String() class Nested: key = Integer()
class SuperNested(Configuration): __section__ = 'Spring.Data.MongoDb' database = String() encryption = Boolean() encryptionKey = String() password = String() replicaSet = String() class Nested: key = Integer()
def test_convert_throws_exception_when_not_string(self): with self.assertRaises(Exception) as context: Boolean().convert(543234) self.assertTrue('Invalid literal for boolean. Not a string: 543234' in str(context.exception))
def test_convert_converts_string_not_yes_true_t_1(self): actual = Boolean().convert('fjkdsla;') self.assertEqual(actual, False)
def test_convert_converts_string_false(self): actual = Boolean().convert('false') self.assertEqual(actual, False)
def test_convert_converts_string_one(self): actual = Boolean().convert('1') self.assertEqual(actual, True)
def test_convert_converts_string_yes_different_case(self): actual = Boolean().convert('YES') self.assertEqual(actual, True)
def test_convert_converts_boolean_False(self): actual = Boolean().convert(False) self.assertEqual(actual, False)
def test_convert_converts_boolean_True(self): actual = Boolean().convert(True) self.assertEqual(actual, True)
class Lower(Configuration): CaseSection = Boolean()