예제 #1
0
    def test_build_1(self):
        data = parse_file(os.path.normpath(os.path.join(os.path.dirname(__file__), 'data', 'hosts-simple')))
        content = build_file(data)
        compare = """# wrong config
127.0.0.1	localhost
# proper config
127.0.0.1	node1.localhost node.local localhost"""
        self.assertEqual(content, compare)
예제 #2
0
 def test_parse_file_1(self):
     data = parse_file(os.path.normpath(os.path.join(os.path.dirname(__file__), 'data', 'hosts-simple')))
     self.assertListEqual\
         ( data
         , [ '# wrong config'
           , ('127.0.0.1', {'localhost', })
           , '# proper config'
           , ('127.0.0.1', {'node1.localhost', 'node.local', 'localhost'})
         ] )