Create a unique submission ID to ensure that an error message
expected in a test is indeed created by this test.

def
insertSampledata(self, data, insert_text, where, after=False):

Insert text into the sample data data.

Insert the text insert_text before the first occurrence of
where in data.

def
replaceSampledata(self, data, replace_text, from_text, to_text):

Replace text in the sample data data.

Search for the first occurrence of from_text in data, and for the
first occurrence of to_text (after from_text) in data.
Replace the text between from_text and to_text by replace_text.
The strings from_text are to_text are part of the text which is
replaced.

def
testNoXMLData(self):

The raw submission data must be XML.

def
testInvalidRootNode(self):

The root node must be <system>.

def
testBadDataInCommentNode(self):

Many submissions contain ESC symbols in <comment> nodes.

The cElementTree parser does not accept this; The processing
script deals with this by emptying all <comment> nodes before
building the element tree. (Note that we don't process data
from this node at all.)

Search for message in the log entries for submission_key.
assertErrorMessage requires that
(a) a log message starts with "Parsing submisson <submission_key>:"
(b) the error message passed as the parameter message appears
in a log string that matches (a)
(c) result, which is supposed to contain an object representing
the result of parsing a submission, is None.
If all three criteria match, assertErrormessage does not raise any
exception.

The fractional part of the seconds is optional as well as the
time zone information ('Z' for UTC or an offset in hh:mm).

def
assertDateErrorIsDetected(self, invalid_datetime):

Run a single test for an invalid datetime.

def
assertValidDateTime(self, datetime_as_string, datetime_expected):

Run a single test for a valid datetime.

def
testClientTagAttributes(self):

Validation of <client> tag attributes.

The <client> tag requires the attributes 'name' and 'version';
other attributes are not allowed.

def
testSubTagsOfClient(self):

The only allowed sub-tag of <client> is <plugin>.

def
testClientPluginAttributes(self):

Validation of <plugin> tag attributes.

The <plugin> tag requires the attributes 'name' and 'version';
other attributes are not allowed.

def
testHardwareSubTagHalOrUdev(self):

The <hardware> tag requires data about hardware devices.

This data is stored either in the sub-tag <hal> or in the
three tags <udev>, <dmi>, <sysfs-attributes>.

def
testHardwareSubTagUdevIncomplete(self):

The <hardware> tag has a fixed set of allowed sub-tags.

Valid sub-tags are <hal>, <udev>, <dmi>, <sysfs-attributes>,
<processors>, <aliases>. <aliases> is optional, <processors>
is required, and either <hal> or all three tags <udev>, <dmi>,
<sysfs-attributes> must be present.

def
testHardwareSubTagHalMixedWithUdev(self):

Mixing <hal> with <udev>, <dmi>, <sysfs-attributes> is impossible.

def
testHardwareOtherSubTags(self):

The <hardware> tag has a fixed set of allowed sub-tags.

def
testHalAttributes(self):

Validation of <hal> tag attributes.

The <hal> tag must have the 'version' attribute; other attributes are
not allowed.

def
testHalSubtags(self):

Validation of sub-tags of <hal>.

<hal> must contain at least one <device> sub-tag. All other sub-tags
are invalid.

def
testDeviceAttributes(self):

Validation of the attributes of the <device> tag.

<device> must have the attributes 'id' and 'udi'; the attribute
'parent' is optional. The latter is already shown by

<device id="130" udi="/org/freedesktop/Hal/devices/computer">

in the standard sample data.

The values of 'id' and 'parent' must be integers. "id" must not
be emtpy.