Пример #1
0
 def test_zeno_nested_loads_nested_dot_notation_nested_key(self):
     self.assertEqual(Zeno('Spring.Data.MongoDb').Nested.key, 5243)
Пример #2
0
 def test_zeno_is_equal_dictionary_when_nothing_set_in_constructor(self):
     self.assertEqual(Zeno(), parsed_yml)
Пример #3
0
 def test_zeno_nested_loads_nested_dot_notation_pass(self):
     self.assertEqual(Zeno('Spring.Data.MongoDb').password, '!54353Ffesf34')
Пример #4
0
 def test_zeno_nested_loads_nested_dot_notation_replica(self):
     self.assertEqual(Zeno('Spring.Data.MongoDb').replicaSet, 'FAKE-DB-531')
Пример #5
0
 def test_zeno_nested_loads_nested_dot_notation_encryption(self):
     self.assertEqual(Zeno('Spring.Data.MongoDb').encryption, True)
Пример #6
0
 def test_zeno_nested_loads_nested_dot_notation_enckey(self):
     self.assertEqual(Zeno('Spring.Data.MongoDb').encryptionKey, 'FakePassWord!')
Пример #7
0
 def test_zeno_nested_loads_second_first_nested(self):
     self.assertEqual(Zeno('Spring').Data.second, 1)
Пример #8
0
 def test_zeno_nested_loads_nested_dot_notation_db(self):
     self.assertEqual(Zeno('Spring.Data.MongoDb').database, 'TESTDB')
Пример #9
0
 def test_zeno_is_equal_dictionary_referencing_third_nested(self):
     self.assertEqual(Zeno('Spring.Data.MongoDb').Nested, parsed_yml['Spring']['Data']['MongoDb']['Nested'])
Пример #10
0
 def test_zeno_nested_loads_list(self):
     self.assertEqual(Zeno('Spring').Data.myList, ['first', 'second', 'third'])
Пример #11
0
 def test_zeno_is_equal_dictionary_referencing_first_nested(self):
     self.assertEqual(Zeno('Spring').Data, parsed_yml['Spring']['Data'])
Пример #12
0
 def test_zeno_is_equal_dictionary(self):
     self.assertEqual(Zeno('Spring'), parsed_yml['Spring'])
Пример #13
0
 def test_cannot_set_attriute_zeno(self):
     with self.assertRaises(AttributeError):
         Zeno().Spring = 1
Пример #14
0
 def test_cannot_set_item_zeno(self):
     with self.assertRaises(AttributeError):
         Zeno()['Spring'] = 1
Пример #15
0
class SuperNested(Configuration):
    """Specifying section"""
    __section__ = 'Spring.Data.MongoDb'

    database = String()
    encryption = Boolean()
    encryptionKey = String()
    password = String()
    replicaSet = String()

    class Nested:
        key = Integer()


print(Spring().Data.myList)  # ['first', 'second', 'third']
print(Spring().Data.MongoDb.encryption is True)  # True
print(MyServer().host)  # my.server.com
print(SuperNested().database)  # TESTDB
print(SuperNested().Nested.key)  # True

# this method is used if specifying a class is not ideal for the user
zeno = Zeno()
print(zeno.Spring.Data.MongoDb.database)  # TESTDB

# if the constructor is specified, it denotes how to search withing the yml file starting
# in the section mongodb withing the data section, within the spring section
# in this case it will be all these member variables: database encryption encryptionKey password replicaSet
zeno_2 = Zeno('Spring.Data.MongoDb')
print(zeno_2.database)  # TESTDB