New version.
[pykickstart.git] / tests / parser / newsection.py
blob746cb94e929e9e37efcc4bcd44c31bba31b6d498
1 import unittest
2 from tests.baseclass import *
4 from pykickstart import constants
5 from pykickstart import sections
6 from pykickstart import version
8 class RawSection(sections.Section):
9 sectionOpen = "%raw"
11 def __init__(self, handler, **kwargs):
12 sections.Section.__init__(self, handler, **kwargs)
13 self.handler.raw = ""
15 def handleLine(self, line):
16 if not self.handler:
17 return
19 self.handler.raw += line
21 class New_Section_TestCase(ParserTest):
22 ks = """
23 %raw
24 1234
25 abcd
26 %end
27 """
29 def runTest(self):
30 self.parser.registerSection(RawSection(self.parser.handler))
31 self.parser.readKickstartFromString(self.ks)
33 # Verify the contents of the custom section were saved.
34 self.assertEqual(self.parser.handler.raw, "1234\nabcd\n")
36 if __name__ == "__main__":
37 unittest.main()