summaryrefslogtreecommitdiff
path: root/tko/parsers/test/templates/base.py
blob: af1bbfcb77966e3ae37f56e42c74c32dbc6dc457 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/python2.4
"""
This is not meant to be executed unless copied into a
scenario package and renamed with a _unittest suffix.
"""

import os, unittest
from os import path
import common
from autotest_lib.tko.parsers.test import scenario_base

GOLDEN = 'golden'


class ParserScenerioTestCase(scenario_base.BaseScenarioTestCase):
    def test_regression(self):
        """We want to ensure that result matches the golden.

        This test is enabled if there is a golden entry
        in the parser_result_store.
        """
        self.skipIf(
            GOLDEN not in self.parser_result_store,
            'No golden data to test against')

        golden = self.parser_result_store[GOLDEN]
        fresh_parser_result = self.harness.execute()
        fresh_copy = scenario_base.copy_parser_result(
            fresh_parser_result)
        self.assertEquals(golden, fresh_copy)


if __name__ == '__main__':
    unittest.main()