confini

Parse and merge multiple ini files in python3
git clone git://git.defalsify.org/python-confini.git
Info | Log | Files | Refs | README | LICENSE

test_censor.py (699B)


      1 # standard imports
      2 import os
      3 import unittest
      4 import logging
      5 
      6 # local imports
      7 from confini import Config
      8 
      9 logging.basicConfig(level=logging.DEBUG)
     10 logg = logging.getLogger()
     11 
     12 
     13  
     14 class TestCensor(unittest.TestCase):
     15 
     16     wd = os.path.dirname(__file__)
     17 
     18     def test_censor(self):
     19         inidir = os.path.join(self.wd, 'files/translate')
     20         c = Config(inidir)
     21         c.process()
     22         c.censor('foo', 'bar')
     23         v = c.apply_censor('BAR_FOO')
     24 
     25         for k in c.all():
     26             try:
     27                 assert v == Config.default_censor_string
     28             except AssertionError:
     29                 self.assertNotEqual('BAR_FOO', k)
     30             
     31 
     32 if __name__ == '__main__':
     33     unittest.main()