Example #1
0
 def test_multiple_docs(self, tempdir):
     yml = '''\
             ---
             a:
                 b: 'ohoh'
             resources:
                 hello:
                     a: 1
             ---
             profile: second
             c:
                 d: 'lalala'
             resources:
                 world:
                     b: 2
            '''
     tempdir.write('loader.yml', dedent(yml).encode())
     assert (reader.read(['loader.yml'])['default']['a'] == {'b': 'ohoh'})
     assert (reader.read(['loader.yml'])['default']['resources'] == {
         'hello': {
             'a': 1
         }
     })
     assert (reader.read(['loader.yml'])['second']['c'] == {'d': 'lalala'})
     assert (reader.read(['loader.yml'])['second']['resources'] == {
         'world': {
             'b': 2
         }
     })
Example #2
0
 def test_minimal_with_resources(self, tempdir):
     yml = '''\
             ---
             a:
                 b: 'ohoh'
                 c: 42
                 s: 1
             resources:
                 hello:
                     best:resource
            '''
     tempdir.write('loader.yml', dedent(yml).encode())
     assert (reader.read([os.path.join(tempdir.path,
                                       'loader.yml')])['default']['a'] == {
                                           'b': 'ohoh',
                                           'c': 42,
                                           's': 1
                                       })
     assert (reader.read([os.path.join(tempdir.path, 'loader.yml')
                          ])['default']['resources'] == {
                              'hello': 'best:resource'
                          })
Example #3
0
 def test_minimal(self, tempdir):
     yml = '''\
            ---
            a:
              b: 'ohoh'
              c: 42
              s: 1
            '''
     tempdir.write('loader.yml', dedent(yml).encode())
     assert (reader.read(['loader.yml'])['default']['a'] == {
         'b': 'ohoh',
         'c': 42,
         's': 1
     })