mbligh | 7c8ea99 | 2009-06-22 19:03:08 +0000 | [diff] [blame^] | 1 | #!/usr/bin/python |
mbligh | f396438 | 2008-11-18 14:58:22 +0000 | [diff] [blame] | 2 | """ |
| 3 | This is not meant to be executed unless copied into a |
| 4 | scenario package and renamed with a _unittest suffix. |
| 5 | """ |
| 6 | |
| 7 | import os, unittest |
| 8 | from os import path |
| 9 | import common |
| 10 | from autotest_lib.tko.parsers.test import scenario_base |
| 11 | |
| 12 | GOLDEN = 'golden' |
| 13 | |
| 14 | |
| 15 | class ParserScenerioTestCase(scenario_base.BaseScenarioTestCase): |
| 16 | def test_regression(self): |
| 17 | """We want to ensure that result matches the golden. |
| 18 | |
| 19 | This test is enabled if there is a golden entry |
| 20 | in the parser_result_store. |
| 21 | """ |
| 22 | self.skipIf( |
| 23 | GOLDEN not in self.parser_result_store, |
| 24 | 'No golden data to test against') |
| 25 | |
| 26 | golden = self.parser_result_store[GOLDEN] |
| 27 | fresh_parser_result = self.harness.execute() |
| 28 | fresh_copy = scenario_base.copy_parser_result( |
| 29 | fresh_parser_result) |
| 30 | self.assertEquals(golden, fresh_copy) |
| 31 | |
| 32 | |
| 33 | if __name__ == '__main__': |
| 34 | unittest.main() |