Chromium Code Reviews| Index: appengine/findit/crash/test/culprit_test.py |
| diff --git a/appengine/findit/crash/test/culprit_test.py b/appengine/findit/crash/test/culprit_test.py |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..cd6b5e4f5aec7ef56605e206b2260fe9b2777c73 |
| --- /dev/null |
| +++ b/appengine/findit/crash/test/culprit_test.py |
| @@ -0,0 +1,38 @@ |
| +# Copyright 2016 The Chromium Authors. All rights reserved. |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| +from crash.culprit import Culprit |
| +from crash.test.crash_testcase import CrashTestCase |
| + |
| + |
| +class CulpritTest(CrashTestCase): |
| + |
| + def testFieldsProperty(self): |
| + culprit = Culprit('', [], [], None, None) |
| + self.assertEqual(culprit.fields, ('project', 'components', 'cls', |
|
wrengr
2016/10/31 23:48:35
N.B., this is fragile. In general Culprit is not d
Sharu Jiang
2016/11/01 23:54:09
Actually we can still get suspected_project and su
wrengr
2016/11/03 16:14:33
No, FindCulprit should return None (or rather: not
|
| + 'regression_range', 'algorithm')) |
| + def testToDicts(self): |
| + culprit = Culprit(None, None, None, None, None) |
|
wrengr
2016/10/31 23:48:35
Again, this is fragile. Culprit expects all the fi
Sharu Jiang
2016/11/01 23:54:09
Still, it's possible that some of those fields are
wrengr
2016/11/03 16:14:33
No, again. The Culprit class is defined to encapsu
|
| + self.assertTupleEqual(culprit.ToDicts(), |
| + ({'found': False}, |
| + {'found_suspects': False, |
| + 'found_project': False, |
| + 'found_components': False, |
| + 'has_regression_range': False, |
| + 'solution': None})) |
| + |
| + cl = self.GetDummyChangeLog() |
|
wrengr
2016/10/31 23:48:35
Below from here should be broken out into a separa
|
| + culprit = Culprit('proj', ['comp'], [cl], ['50.0.1234.1', '50.0.1234.2'], |
| + 'core_algorithm') |
| + self.assertTupleEqual(culprit.ToDicts(), |
| + ({'found': True, |
| + 'regression_range': ['50.0.1234.1', '50.0.1234.2'], |
| + 'suspected_project': 'proj', |
| + 'suspected_components': ['comp'], |
| + 'suspected_cls': [cl.ToDict()]}, |
| + {'found_suspects': True, |
| + 'found_project': True, |
| + 'found_components': True, |
| + 'has_regression_range': True, |
| + 'solution': 'core_algorithm'})) |