OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 | 2 |
3 """ | 3 """ |
4 Copyright 2013 Google Inc. | 4 Copyright 2013 Google Inc. |
5 | 5 |
6 Use of this source code is governed by a BSD-style license that can be | 6 Use of this source code is governed by a BSD-style license that can be |
7 found in the LICENSE file. | 7 found in the LICENSE file. |
8 | 8 |
9 Test results.py | 9 Test results.py |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 | 29 |
30 class ResultsTest(base_unittest.TestCase): | 30 class ResultsTest(base_unittest.TestCase): |
31 | 31 |
32 def test_gm(self): | 32 def test_gm(self): |
33 """Process results of a GM run with the Results object.""" | 33 """Process results of a GM run with the Results object.""" |
34 results_obj = results.Results( | 34 results_obj = results.Results( |
35 actuals_root=os.path.join(self._input_dir, 'gm-actuals'), | 35 actuals_root=os.path.join(self._input_dir, 'gm-actuals'), |
36 expected_root=os.path.join(self._input_dir, 'gm-expectations'), | 36 expected_root=os.path.join(self._input_dir, 'gm-expectations'), |
37 generated_images_root=self._temp_dir) | 37 generated_images_root=self._temp_dir) |
| 38 results_obj.get_timestamp = mock_get_timestamp |
38 gm_json.WriteToFile( | 39 gm_json.WriteToFile( |
39 results_obj.get_results_of_type(results.KEY__HEADER__RESULTS_ALL), | 40 results_obj.get_packaged_results_of_type( |
| 41 results.KEY__HEADER__RESULTS_ALL), |
40 os.path.join(self._output_dir_actual, 'gm.json')) | 42 os.path.join(self._output_dir_actual, 'gm.json')) |
41 | 43 |
42 | 44 |
| 45 def mock_get_timestamp(): |
| 46 """Mock version of Results.get_timestamp() for testing.""" |
| 47 return 12345678 |
| 48 |
| 49 |
43 def main(): | 50 def main(): |
44 base_unittest.main(ResultsTest) | 51 base_unittest.main(ResultsTest) |
45 | 52 |
46 | 53 |
47 if __name__ == '__main__': | 54 if __name__ == '__main__': |
48 main() | 55 main() |
OLD | NEW |