24 lines
770 B
Python
24 lines
770 B
Python
import os
|
|
from pathlib import Path
|
|
from unittest import TestCase
|
|
|
|
import yaml
|
|
|
|
from app.services import Passwords
|
|
from app.services.mo import Mo
|
|
|
|
|
|
class TestMo(TestCase):
|
|
def test_process(self):
|
|
target_path = Path('tests/files/test1/test.yaml')
|
|
mo = Mo(Passwords())
|
|
mo.process(Path('tests/files/test1/test.mo.yaml').absolute())
|
|
self.assertTrue(os.path.exists(target_path))
|
|
with open(target_path, 'r') as f:
|
|
content = f.read()
|
|
self.assertFalse(content.__contains__('${'))
|
|
self.assertFalse(content.__contains__('%{'))
|
|
parsed = yaml.load(content, Loader=yaml.FullLoader)
|
|
self.assertEqual('some_pass', parsed['value'])
|
|
self.assertEqual('nested_pass', parsed['nested'])
|
|
self.assertEqual('custom_content', parsed['custom'])
|