OLD | NEW |
---|---|
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import registry_verifier | 5 from registry_verifier import RegistryVerifier |
6 | 6 |
7 def Verify(property): | 7 class Verifier: |
8 """Verifies that the current machine states match the property object.""" | 8 """Verifies that the current machine state matches the expected machine |
9 for verifier_name, value in property.iteritems(): | 9 state.""" |
10 if verifier_name == 'RegistryEntries': | 10 |
11 registry_verifier.VerifyRegistryEntries(value) | 11 def __init__(self, testcase): |
12 else: | 12 """Constructor. |
13 # TODO(sukolsak): Implement other verifiers | 13 |
14 # TODO(sukolsak): Use unittest framework instead of exceptions. | 14 Args: |
15 raise Exception('Unknown verifier') | 15 testcase: A unittest.TestCase instance. |
16 """ | |
17 self.testcase = testcase | |
18 self.registry_verifier = RegistryVerifier(testcase) | |
gab
2013/08/08 02:07:08
How about a single dictionary of verifiers, e.g.:
robertshield
2013/08/09 19:00:15
I agree with the notion of having Verifiers derive
| |
19 | |
20 def Verify(self, property): | |
robertshield
2013/08/09 19:00:15
If the comment above is followed, this would then
sukolsak
2013/08/09 21:12:38
Done.
| |
21 """Verifies that the current machine states match the property dictionary. | |
22 | |
23 Args: | |
24 property: A property dictionary. | |
25 """ | |
26 for verifier_name, value in property.iteritems(): | |
27 if verifier_name == 'RegistryEntries': | |
28 self.registry_verifier.VerifyRegistryEntries(value) | |
29 else: | |
30 # TODO(sukolsak): Implement other verifiers | |
31 self.testcase.fail('Unknown verifier %s' % verifier_name) | |
OLD | NEW |