24 def test_parse_header(self):
25 """
26 Test if the xml header in validation scripts are parsed properly
27 """
28 with tempfile.NamedTemporaryFile() as tf:
29 tf.write(
30 b"#!/usr/bin/env python3\n"
31 b'"""\n'
32 b"<header>\n"
33 b"<interval>release</interval>"
34 b"<output>EvtGenSim.root</output>\n"
35 b"<contact>Thomas Kuhr thomas.kuhr@lmu.de</contact>\n"
36 b"<description>description_text</description>\n"
37 b"</header>\n"
38 b'"""\n'
39 )
40
41
42
43 tf.flush()
44
45 script = validationscript.Script(tf.name, "package", None)
46 script.load_header()
47
48 self.assertEqual("description_text", script.description)
49 self.assertEqual(
50 "Thomas Kuhr thomas.kuhr@lmu.de", script.contact[0]
51 )
52 self.assertEqual(1, len(script.output_files))
53 self.assertEqual("EvtGenSim.root", script.output_files[0])
54 self.assertEqual("release", script.interval)
55
56