| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 | 6 |
| 7 """Unittests for writers.admx_writer.""" | 7 """Unittests for writers.admx_writer.""" |
| 8 | 8 |
| 9 | 9 |
| 10 import os | 10 import os |
| 11 import sys | 11 import sys |
| 12 import unittest | 12 import unittest |
| 13 if __name__ == '__main__': | 13 if __name__ == '__main__': |
| 14 sys.path.append(os.path.join(os.path.dirname(__file__), '../../../..')) | 14 sys.path.append(os.path.join(os.path.dirname(__file__), '../../../..')) |
| 15 | 15 |
| 16 | 16 |
| 17 from writers import admx_writer | 17 from writers import admx_writer |
| 18 from writers import xml_writer_base_unittest | 18 from writers import xml_writer_base_unittest |
| 19 from xml.dom import minidom | 19 from xml.dom import minidom |
| 20 | 20 |
| 21 | 21 |
| 22 class AdmxWriterUnittest(xml_writer_base_unittest.XmlWriterBaseTest): | 22 class AdmxWriterUnittest(xml_writer_base_unittest.XmlWriterBaseTest): |
| 23 | 23 |
| 24 def _CreateDocumentElement(self): |
| 25 dom_impl = minidom.getDOMImplementation('') |
| 26 doc = dom_impl.createDocument(None, 'root', None) |
| 27 return doc.documentElement |
| 28 |
| 24 def setUp(self): | 29 def setUp(self): |
| 25 # Writer configuration. This dictionary contains parameter used by the ADMX | 30 # Writer configuration. This dictionary contains parameter used by the ADMX |
| 26 # Writer | 31 # Writer |
| 27 config = { | 32 config = { |
| 28 'win_group_policy_class': 'TestClass', | |
| 29 'win_supported_os': 'SUPPORTED_TESTOS', | 33 'win_supported_os': 'SUPPORTED_TESTOS', |
| 30 'win_reg_mandatory_key_name': 'Software\\Policies\\Test', | 34 'win_config' : { |
| 31 'win_reg_recommended_key_name': 'Software\\Policies\\Test\\Recommended', | 35 'win' : { |
| 32 'win_mandatory_category_path': ['test_category'], | 36 'reg_mandatory_key_name': 'Software\\Policies\\Test', |
| 33 'win_recommended_category_path': ['test_recommended_category'], | 37 'reg_recommended_key_name': 'Software\\Policies\\Test\\Recommended', |
| 34 'win_category_path_strings': { | 38 'mandatory_category_path': ['test_category'], |
| 35 'test_category': 'TestCategory', | 39 'recommended_category_path': ['test_recommended_category'], |
| 36 'test_recommended_category': 'TestCategory - recommended' | 40 'category_path_strings': { |
| 41 'test_category': 'TestCategory', |
| 42 'test_recommended_category': 'TestCategory - recommended', |
| 43 }, |
| 44 'namespace': 'ADMXWriter.Test.Namespace', |
| 45 }, |
| 46 'chrome_os' : { |
| 47 'reg_mandatory_key_name': 'Software\\Policies\\CrOSTest', |
| 48 'reg_recommended_key_name': |
| 49 'Software\\Policies\\CrOSTest\\Recommended', |
| 50 'mandatory_category_path': ['cros_test_category'], |
| 51 'recommended_category_path': ['cros_test_recommended_category'], |
| 52 'category_path_strings': { |
| 53 'cros_test_category': 'CrOSTestCategory', |
| 54 'cros_test_recommended_category': 'CrOSTestCategory - recommended', |
| 55 }, |
| 56 'namespace': 'ADMXWriter.Test.Namespace.ChromeOS', |
| 57 }, |
| 37 }, | 58 }, |
| 38 'admx_namespace': 'ADMXWriter.Test.Namespace', | |
| 39 'admx_prefix': 'test_prefix', | 59 'admx_prefix': 'test_prefix', |
| 40 'build': 'test_product', | 60 'build': 'test_product', |
| 41 } | 61 } |
| 42 self.writer = admx_writer.GetWriter(config) | 62 self.writer = self._GetWriter(config) |
| 43 self.writer.Init() | 63 self.writer.Init() |
| 44 | 64 |
| 65 def _GetWriter(self, config): |
| 66 return admx_writer.GetWriter(config) |
| 67 |
| 68 def _GetKey(self): |
| 69 return "Test"; |
| 70 |
| 71 def _GetCategory(self): |
| 72 return "test_category"; |
| 73 |
| 74 def _GetCategoryRec(self): |
| 75 return "test_recommended_category"; |
| 76 |
| 77 def _GetNamespace(self): |
| 78 return "ADMXWriter.Test.Namespace"; |
| 79 |
| 45 def _GetPoliciesElement(self, doc): | 80 def _GetPoliciesElement(self, doc): |
| 46 node_list = doc.getElementsByTagName('policies') | 81 node_list = doc.getElementsByTagName('policies') |
| 47 self.assertTrue(node_list.length == 1) | 82 self.assertTrue(node_list.length == 1) |
| 48 return node_list.item(0) | 83 return node_list.item(0) |
| 49 | 84 |
| 50 def _GetCategoriesElement(self, doc): | 85 def _GetCategoriesElement(self, doc): |
| 51 node_list = doc.getElementsByTagName('categories') | 86 node_list = doc.getElementsByTagName('categories') |
| 52 self.assertTrue(node_list.length == 1) | 87 self.assertTrue(node_list.length == 1) |
| 53 return node_list.item(0) | 88 return node_list.item(0) |
| 54 | 89 |
| 55 def testEmpty(self): | 90 def testEmpty(self): |
| 56 self.writer.BeginTemplate() | 91 self.writer.BeginTemplate() |
| 57 self.writer.EndTemplate() | 92 self.writer.EndTemplate() |
| 58 | 93 |
| 59 output = self.writer.GetTemplateText() | 94 output = self.writer.GetTemplateText() |
| 60 expected_output = ( | 95 expected_output = ( |
| 61 '<?xml version="1.0" ?>\n' | 96 '<?xml version="1.0" ?>\n' |
| 62 '<policyDefinitions revision="1.0" schemaVersion="1.0">\n' | 97 '<policyDefinitions revision="1.0" schemaVersion="1.0">\n' |
| 63 ' <policyNamespaces>\n' | 98 ' <policyNamespaces>\n' |
| 64 ' <target namespace="ADMXWriter.Test.Namespace"' | 99 ' <target namespace="' + self._GetNamespace() + '"' |
| 65 ' prefix="test_prefix"/>\n' | 100 ' prefix="test_prefix"/>\n' |
| 66 ' <using namespace="Microsoft.Policies.Windows" prefix="windows"/>\n' | 101 ' <using namespace="Microsoft.Policies.Windows" prefix="windows"/>\n' |
| 67 ' </policyNamespaces>\n' | 102 ' </policyNamespaces>\n' |
| 68 ' <resources minRequiredRevision="1.0"/>\n' | 103 ' <resources minRequiredRevision="1.0"/>\n' |
| 69 ' <supportedOn>\n' | 104 ' <supportedOn>\n' |
| 70 ' <definitions>\n' | 105 ' <definitions>\n' |
| 71 ' <definition displayName="' | 106 ' <definition displayName="' |
| 72 '$(string.SUPPORTED_TESTOS)" name="SUPPORTED_TESTOS"/>\n' | 107 '$(string.SUPPORTED_TESTOS)" name="SUPPORTED_TESTOS"/>\n' |
| 73 ' </definitions>\n' | 108 ' </definitions>\n' |
| 74 ' </supportedOn>\n' | 109 ' </supportedOn>\n' |
| 75 ' <categories>\n' | 110 ' <categories>\n' |
| 76 ' <category displayName="$(string.test_category)"' | 111 ' <category displayName="$(string.' + self._GetCategory() + ')"' |
| 77 ' name="test_category"/>\n' | 112 ' name="' + self._GetCategory() + '"/>\n' |
| 78 ' <category displayName="$(string.test_recommended_category)"' | 113 ' <category displayName="$(string.' + self._GetCategoryRec() + ')"' |
| 79 ' name="test_recommended_category"/>\n' | 114 ' name="' + self._GetCategoryRec() + '"/>\n' |
| 80 ' </categories>\n' | 115 ' </categories>\n' |
| 81 ' <policies/>\n' | 116 ' <policies/>\n' |
| 82 '</policyDefinitions>') | 117 '</policyDefinitions>') |
| 83 self.AssertXMLEquals(output, expected_output) | 118 self.AssertXMLEquals(output, expected_output) |
| 84 | 119 |
| 85 def testEmptyVersion(self): | 120 def testEmptyVersion(self): |
| 86 self.writer.config['version'] = '39.0.0.0' | 121 self.writer.config['version'] = '39.0.0.0' |
| 87 self.writer.BeginTemplate() | 122 self.writer.BeginTemplate() |
| 88 self.writer.EndTemplate() | 123 self.writer.EndTemplate() |
| 89 | 124 |
| 90 output = self.writer.GetTemplateText() | 125 output = self.writer.GetTemplateText() |
| 91 expected_output = ( | 126 expected_output = ( |
| 92 '<?xml version="1.0" ?>\n' | 127 '<?xml version="1.0" ?>\n' |
| 93 '<policyDefinitions revision="1.0" schemaVersion="1.0">\n' | 128 '<policyDefinitions revision="1.0" schemaVersion="1.0">\n' |
| 94 ' <!--test_product version: 39.0.0.0-->\n' | 129 ' <!--test_product version: 39.0.0.0-->\n' |
| 95 ' <policyNamespaces>\n' | 130 ' <policyNamespaces>\n' |
| 96 ' <target namespace="ADMXWriter.Test.Namespace"' | 131 ' <target namespace="' + self._GetNamespace() + '"' |
| 97 ' prefix="test_prefix"/>\n' | 132 ' prefix="test_prefix"/>\n' |
| 98 ' <using namespace="Microsoft.Policies.Windows" prefix="windows"/>\n' | 133 ' <using namespace="Microsoft.Policies.Windows" prefix="windows"/>\n' |
| 99 ' </policyNamespaces>\n' | 134 ' </policyNamespaces>\n' |
| 100 ' <resources minRequiredRevision="1.0"/>\n' | 135 ' <resources minRequiredRevision="1.0"/>\n' |
| 101 ' <supportedOn>\n' | 136 ' <supportedOn>\n' |
| 102 ' <definitions>\n' | 137 ' <definitions>\n' |
| 103 ' <definition displayName="' | 138 ' <definition displayName="' |
| 104 '$(string.SUPPORTED_TESTOS)" name="SUPPORTED_TESTOS"/>\n' | 139 '$(string.SUPPORTED_TESTOS)" name="SUPPORTED_TESTOS"/>\n' |
| 105 ' </definitions>\n' | 140 ' </definitions>\n' |
| 106 ' </supportedOn>\n' | 141 ' </supportedOn>\n' |
| 107 ' <categories>\n' | 142 ' <categories>\n' |
| 108 ' <category displayName="$(string.test_category)"' | 143 ' <category displayName="$(string.' + self._GetCategory() + ')"' |
| 109 ' name="test_category"/>\n' | 144 ' name="' + self._GetCategory() + '"/>\n' |
| 110 ' <category displayName="$(string.test_recommended_category)"' | 145 ' <category displayName="$(string.' + self._GetCategoryRec() + ')"' |
| 111 ' name="test_recommended_category"/>\n' | 146 ' name="' + self._GetCategoryRec() + '"/>\n' |
| 112 ' </categories>\n' | 147 ' </categories>\n' |
| 113 ' <policies/>\n' | 148 ' <policies/>\n' |
| 114 '</policyDefinitions>') | 149 '</policyDefinitions>') |
| 115 self.AssertXMLEquals(output, expected_output) | 150 self.AssertXMLEquals(output, expected_output) |
| 116 | 151 |
| 117 def testEmptyPolicyGroup(self): | 152 def testEmptyPolicyGroup(self): |
| 118 empty_policy_group = { | 153 empty_policy_group = { |
| 119 'name': 'PolicyGroup', | 154 'name': 'PolicyGroup', |
| 120 'policies': [] | 155 'policies': [] |
| 121 } | 156 } |
| 122 # Initialize writer to write a policy group. | 157 # Initialize writer to write a policy group. |
| 123 self.writer.BeginTemplate() | 158 self.writer.BeginTemplate() |
| 124 # Write policy group | 159 # Write policy group |
| 125 self.writer.BeginPolicyGroup(empty_policy_group) | 160 self.writer.BeginPolicyGroup(empty_policy_group) |
| 126 self.writer.EndPolicyGroup() | 161 self.writer.EndPolicyGroup() |
| 127 | 162 |
| 128 output = self.GetXMLOfChildren(self._GetPoliciesElement(self.writer._doc)) | 163 output = self.GetXMLOfChildren(self._GetPoliciesElement(self.writer._doc)) |
| 129 expected_output = '' | 164 expected_output = '' |
| 130 self.AssertXMLEquals(output, expected_output) | 165 self.AssertXMLEquals(output, expected_output) |
| 131 | 166 |
| 132 output = self.GetXMLOfChildren( | 167 output = self.GetXMLOfChildren( |
| 133 self._GetCategoriesElement(self.writer._doc)) | 168 self._GetCategoriesElement(self.writer._doc)) |
| 134 expected_output = ( | 169 expected_output = ( |
| 135 '<category displayName="$(string.test_category)"' | 170 '<category displayName="$(string.' + self._GetCategory() + ')"' |
| 136 ' name="test_category"/>\n' | 171 ' name="' + self._GetCategory() + '"/>\n' |
| 137 '<category displayName="$(string.test_recommended_category)"' | 172 '<category displayName="$(string.' + self._GetCategoryRec() + ')"' |
| 138 ' name="test_recommended_category"/>\n' | 173 ' name="' + self._GetCategoryRec() + '"/>\n' |
| 139 '<category displayName="$(string.PolicyGroup_group)"' | 174 '<category displayName="$(string.PolicyGroup_group)"' |
| 140 ' name="PolicyGroup">\n' | 175 ' name="PolicyGroup">\n' |
| 141 ' <parentCategory ref="test_category"/>\n' | 176 ' <parentCategory ref="' + self._GetCategory() + '"/>\n' |
| 142 '</category>') | 177 '</category>') |
| 143 | 178 |
| 144 self.AssertXMLEquals(output, expected_output) | 179 self.AssertXMLEquals(output, expected_output) |
| 145 | 180 |
| 146 def testPolicyGroup(self): | 181 def testPolicyGroup(self): |
| 147 empty_policy_group = { | 182 empty_policy_group = { |
| 148 'name': 'PolicyGroup', | 183 'name': 'PolicyGroup', |
| 149 'policies': [ | 184 'policies': [ |
| 150 {'name': 'PolicyStub2', | 185 {'name': 'PolicyStub2', |
| 151 'type': 'main'}, | 186 'type': 'main'}, |
| 152 {'name': 'PolicyStub1', | 187 {'name': 'PolicyStub1', |
| 153 'type': 'main'}, | 188 'type': 'main'}, |
| 154 ] | 189 ] |
| 155 } | 190 } |
| 156 # Initialize writer to write a policy group. | 191 # Initialize writer to write a policy group. |
| 157 self.writer.BeginTemplate() | 192 self.writer.BeginTemplate() |
| 158 # Write policy group | 193 # Write policy group |
| 159 self.writer.BeginPolicyGroup(empty_policy_group) | 194 self.writer.BeginPolicyGroup(empty_policy_group) |
| 160 self.writer.EndPolicyGroup() | 195 self.writer.EndPolicyGroup() |
| 161 | 196 |
| 162 output = self.GetXMLOfChildren(self._GetPoliciesElement(self.writer._doc)) | 197 output = self.GetXMLOfChildren(self._GetPoliciesElement(self.writer._doc)) |
| 163 expected_output = '' | 198 expected_output = '' |
| 164 self.AssertXMLEquals(output, expected_output) | 199 self.AssertXMLEquals(output, expected_output) |
| 165 | 200 |
| 166 output = self.GetXMLOfChildren( | 201 output = self.GetXMLOfChildren( |
| 167 self._GetCategoriesElement(self.writer._doc)) | 202 self._GetCategoriesElement(self.writer._doc)) |
| 168 expected_output = ( | 203 expected_output = ( |
| 169 '<category displayName="$(string.test_category)"' | 204 '<category displayName="$(string.' + self._GetCategory() + ')"' |
| 170 ' name="test_category"/>\n' | 205 ' name="' + self._GetCategory() + '"/>\n' |
| 171 '<category displayName="$(string.test_recommended_category)"' | 206 '<category displayName="$(string.' + self._GetCategoryRec() + ')"' |
| 172 ' name="test_recommended_category"/>\n' | 207 ' name="' + self._GetCategoryRec() + '"/>\n' |
| 173 '<category displayName="$(string.PolicyGroup_group)"' | 208 '<category displayName="$(string.PolicyGroup_group)"' |
| 174 ' name="PolicyGroup">\n' | 209 ' name="PolicyGroup">\n' |
| 175 ' <parentCategory ref="test_category"/>\n' | 210 ' <parentCategory ref="' + self._GetCategory() + '"/>\n' |
| 176 '</category>') | 211 '</category>') |
| 177 self.AssertXMLEquals(output, expected_output) | 212 self.AssertXMLEquals(output, expected_output) |
| 178 | 213 |
| 179 | 214 |
| 180 def _initWriterForPolicy(self, writer, policy): | 215 def _initWriterForPolicy(self, writer, policy): |
| 181 '''Initializes the writer to write the given policy next. | 216 '''Initializes the writer to write the given policy next. |
| 182 ''' | 217 ''' |
| 183 policy_group = { | 218 policy_group = { |
| 184 'name': 'PolicyGroup', | 219 'name': 'PolicyGroup', |
| 185 'policies': [policy] | 220 'policies': [policy] |
| 186 } | 221 } |
| 187 writer.BeginTemplate() | 222 writer.BeginTemplate() |
| 188 writer.BeginPolicyGroup(policy_group) | 223 writer.BeginPolicyGroup(policy_group) |
| 189 | 224 |
| 190 def testMainPolicy(self): | 225 def testMainPolicy(self): |
| 191 main_policy = { | 226 main_policy = { |
| 192 'name': 'DummyMainPolicy', | 227 'name': 'DummyMainPolicy', |
| 193 'type': 'main', | 228 'type': 'main', |
| 194 } | 229 } |
| 195 | 230 |
| 196 self._initWriterForPolicy(self.writer, main_policy) | 231 self._initWriterForPolicy(self.writer, main_policy) |
| 197 | 232 |
| 198 self.writer.WritePolicy(main_policy) | 233 self.writer.WritePolicy(main_policy) |
| 199 | 234 |
| 200 output = self.GetXMLOfChildren(self._GetPoliciesElement(self.writer._doc)) | 235 output = self.GetXMLOfChildren(self._GetPoliciesElement(self.writer._doc)) |
| 201 expected_output = ( | 236 expected_output = ( |
| 202 '<policy class="TestClass" displayName="$(string.DummyMainPolicy)"' | 237 '<policy class="' + self.writer.GetClass(main_policy) + '"' |
| 238 ' displayName="$(string.DummyMainPolicy)"' |
| 203 ' explainText="$(string.DummyMainPolicy_Explain)"' | 239 ' explainText="$(string.DummyMainPolicy_Explain)"' |
| 204 ' key="Software\\Policies\\Test" name="DummyMainPolicy"' | 240 ' key="Software\\Policies\\' + self._GetKey() + '"' |
| 241 ' name="DummyMainPolicy"' |
| 205 ' presentation="$(presentation.DummyMainPolicy)"' | 242 ' presentation="$(presentation.DummyMainPolicy)"' |
| 206 ' valueName="DummyMainPolicy">\n' | 243 ' valueName="DummyMainPolicy">\n' |
| 207 ' <parentCategory ref="PolicyGroup"/>\n' | 244 ' <parentCategory ref="PolicyGroup"/>\n' |
| 208 ' <supportedOn ref="SUPPORTED_TESTOS"/>\n' | 245 ' <supportedOn ref="SUPPORTED_TESTOS"/>\n' |
| 209 ' <enabledValue>\n' | 246 ' <enabledValue>\n' |
| 210 ' <decimal value="1"/>\n' | 247 ' <decimal value="1"/>\n' |
| 211 ' </enabledValue>\n' | 248 ' </enabledValue>\n' |
| 212 ' <disabledValue>\n' | 249 ' <disabledValue>\n' |
| 213 ' <decimal value="0"/>\n' | 250 ' <decimal value="0"/>\n' |
| 214 ' </disabledValue>\n' | 251 ' </disabledValue>\n' |
| (...skipping 11 matching lines...) Expand all Loading... |
| 226 'name': 'PolicyGroup', | 263 'name': 'PolicyGroup', |
| 227 'policies': [main_policy], | 264 'policies': [main_policy], |
| 228 } | 265 } |
| 229 self.writer.BeginTemplate() | 266 self.writer.BeginTemplate() |
| 230 self.writer.BeginRecommendedPolicyGroup(policy_group) | 267 self.writer.BeginRecommendedPolicyGroup(policy_group) |
| 231 | 268 |
| 232 self.writer.WriteRecommendedPolicy(main_policy) | 269 self.writer.WriteRecommendedPolicy(main_policy) |
| 233 | 270 |
| 234 output = self.GetXMLOfChildren(self._GetPoliciesElement(self.writer._doc)) | 271 output = self.GetXMLOfChildren(self._GetPoliciesElement(self.writer._doc)) |
| 235 expected_output = ( | 272 expected_output = ( |
| 236 '<policy class="TestClass" displayName="$(string.DummyMainPolicy)"' | 273 '<policy class="' + self.writer.GetClass(main_policy) + '"' |
| 274 ' displayName="$(string.DummyMainPolicy)"' |
| 237 ' explainText="$(string.DummyMainPolicy_Explain)"' | 275 ' explainText="$(string.DummyMainPolicy_Explain)"' |
| 238 ' key="Software\\Policies\\Test\\Recommended"' | 276 ' key="Software\\Policies\\' + self._GetKey() + '\\Recommended"' |
| 239 ' name="DummyMainPolicy_recommended"' | 277 ' name="DummyMainPolicy_recommended"' |
| 240 ' presentation="$(presentation.DummyMainPolicy)"' | 278 ' presentation="$(presentation.DummyMainPolicy)"' |
| 241 ' valueName="DummyMainPolicy">\n' | 279 ' valueName="DummyMainPolicy">\n' |
| 242 ' <parentCategory ref="PolicyGroup_recommended"/>\n' | 280 ' <parentCategory ref="PolicyGroup_recommended"/>\n' |
| 243 ' <supportedOn ref="SUPPORTED_TESTOS"/>\n' | 281 ' <supportedOn ref="SUPPORTED_TESTOS"/>\n' |
| 244 ' <enabledValue>\n' | 282 ' <enabledValue>\n' |
| 245 ' <decimal value="1"/>\n' | 283 ' <decimal value="1"/>\n' |
| 246 ' </enabledValue>\n' | 284 ' </enabledValue>\n' |
| 247 ' <disabledValue>\n' | 285 ' <disabledValue>\n' |
| 248 ' <decimal value="0"/>\n' | 286 ' <decimal value="0"/>\n' |
| (...skipping 17 matching lines...) Expand all Loading... |
| 266 'policies': [main_policy], | 304 'policies': [main_policy], |
| 267 } | 305 } |
| 268 self.writer.BeginTemplate() | 306 self.writer.BeginTemplate() |
| 269 self.writer.BeginRecommendedPolicyGroup(policy_group) | 307 self.writer.BeginRecommendedPolicyGroup(policy_group) |
| 270 | 308 |
| 271 self.writer.WritePolicy(main_policy) | 309 self.writer.WritePolicy(main_policy) |
| 272 self.writer.WriteRecommendedPolicy(main_policy) | 310 self.writer.WriteRecommendedPolicy(main_policy) |
| 273 | 311 |
| 274 output = self.GetXMLOfChildren(self._GetPoliciesElement(self.writer._doc)) | 312 output = self.GetXMLOfChildren(self._GetPoliciesElement(self.writer._doc)) |
| 275 expected_output = ( | 313 expected_output = ( |
| 276 '<policy class="TestClass" displayName="$(string.DummyMainPolicy)"' | 314 '<policy class="' + self.writer.GetClass(main_policy) + '"' |
| 315 ' displayName="$(string.DummyMainPolicy)"' |
| 277 ' explainText="$(string.DummyMainPolicy_Explain)"' | 316 ' explainText="$(string.DummyMainPolicy_Explain)"' |
| 278 ' key="Software\\Policies\\Test\\Recommended"' | 317 ' key="Software\\Policies\\' + self._GetKey() + '\\Recommended"' |
| 279 ' name="DummyMainPolicy_recommended"' | 318 ' name="DummyMainPolicy_recommended"' |
| 280 ' presentation="$(presentation.DummyMainPolicy)"' | 319 ' presentation="$(presentation.DummyMainPolicy)"' |
| 281 ' valueName="DummyMainPolicy">\n' | 320 ' valueName="DummyMainPolicy">\n' |
| 282 ' <parentCategory ref="PolicyGroup_recommended"/>\n' | 321 ' <parentCategory ref="PolicyGroup_recommended"/>\n' |
| 283 ' <supportedOn ref="SUPPORTED_TESTOS"/>\n' | 322 ' <supportedOn ref="SUPPORTED_TESTOS"/>\n' |
| 284 ' <enabledValue>\n' | 323 ' <enabledValue>\n' |
| 285 ' <decimal value="1"/>\n' | 324 ' <decimal value="1"/>\n' |
| 286 ' </enabledValue>\n' | 325 ' </enabledValue>\n' |
| 287 ' <disabledValue>\n' | 326 ' <disabledValue>\n' |
| 288 ' <decimal value="0"/>\n' | 327 ' <decimal value="0"/>\n' |
| 289 ' </disabledValue>\n' | 328 ' </disabledValue>\n' |
| 290 '</policy>') | 329 '</policy>') |
| 291 | 330 |
| 292 self.AssertXMLEquals(output, expected_output) | 331 self.AssertXMLEquals(output, expected_output) |
| 293 | 332 |
| 294 def testStringPolicy(self): | 333 def testStringPolicy(self): |
| 295 string_policy = { | 334 string_policy = { |
| 296 'name': 'SampleStringPolicy', | 335 'name': 'SampleStringPolicy', |
| 297 'type': 'string', | 336 'type': 'string', |
| 298 } | 337 } |
| 299 self._initWriterForPolicy(self.writer, string_policy) | 338 self._initWriterForPolicy(self.writer, string_policy) |
| 300 | 339 |
| 301 self.writer.WritePolicy(string_policy) | 340 self.writer.WritePolicy(string_policy) |
| 302 output = self.GetXMLOfChildren(self._GetPoliciesElement(self.writer._doc)) | 341 output = self.GetXMLOfChildren(self._GetPoliciesElement(self.writer._doc)) |
| 303 expected_output = ( | 342 expected_output = ( |
| 304 '<policy class="TestClass" displayName="$(string.SampleStringPolicy)"' | 343 '<policy class="' + self.writer.GetClass(string_policy) + '"' |
| 344 ' displayName="$(string.SampleStringPolicy)"' |
| 305 ' explainText="$(string.SampleStringPolicy_Explain)"' | 345 ' explainText="$(string.SampleStringPolicy_Explain)"' |
| 306 ' key="Software\\Policies\\Test" name="SampleStringPolicy"' | 346 ' key="Software\\Policies\\' + self._GetKey() + '"' |
| 347 ' name="SampleStringPolicy"' |
| 307 ' presentation="$(presentation.SampleStringPolicy)">\n' | 348 ' presentation="$(presentation.SampleStringPolicy)">\n' |
| 308 ' <parentCategory ref="PolicyGroup"/>\n' | 349 ' <parentCategory ref="PolicyGroup"/>\n' |
| 309 ' <supportedOn ref="SUPPORTED_TESTOS"/>\n' | 350 ' <supportedOn ref="SUPPORTED_TESTOS"/>\n' |
| 310 ' <elements>\n' | 351 ' <elements>\n' |
| 311 ' <text id="SampleStringPolicy" maxLength="1000000"' | 352 ' <text id="SampleStringPolicy" maxLength="1000000"' |
| 312 ' valueName="SampleStringPolicy"/>\n' | 353 ' valueName="SampleStringPolicy"/>\n' |
| 313 ' </elements>\n' | 354 ' </elements>\n' |
| 314 '</policy>') | 355 '</policy>') |
| 315 self.AssertXMLEquals(output, expected_output) | 356 self.AssertXMLEquals(output, expected_output) |
| 316 | 357 |
| 317 def testIntPolicy(self): | 358 def testIntPolicy(self): |
| 318 int_policy = { | 359 int_policy = { |
| 319 'name': 'SampleIntPolicy', | 360 'name': 'SampleIntPolicy', |
| 320 'type': 'int', | 361 'type': 'int', |
| 321 } | 362 } |
| 322 self._initWriterForPolicy(self.writer, int_policy) | 363 self._initWriterForPolicy(self.writer, int_policy) |
| 323 | 364 |
| 324 self.writer.WritePolicy(int_policy) | 365 self.writer.WritePolicy(int_policy) |
| 325 output = self.GetXMLOfChildren(self._GetPoliciesElement(self.writer._doc)) | 366 output = self.GetXMLOfChildren(self._GetPoliciesElement(self.writer._doc)) |
| 326 expected_output = ( | 367 expected_output = ( |
| 327 '<policy class="TestClass" displayName="$(string.SampleIntPolicy)"' | 368 '<policy class="' + self.writer.GetClass(int_policy) + '"' |
| 369 ' displayName="$(string.SampleIntPolicy)"' |
| 328 ' explainText="$(string.SampleIntPolicy_Explain)"' | 370 ' explainText="$(string.SampleIntPolicy_Explain)"' |
| 329 ' key="Software\\Policies\\Test" name="SampleIntPolicy"' | 371 ' key="Software\\Policies\\' + self._GetKey() + '"' |
| 372 ' name="SampleIntPolicy"' |
| 330 ' presentation="$(presentation.SampleIntPolicy)">\n' | 373 ' presentation="$(presentation.SampleIntPolicy)">\n' |
| 331 ' <parentCategory ref="PolicyGroup"/>\n' | 374 ' <parentCategory ref="PolicyGroup"/>\n' |
| 332 ' <supportedOn ref="SUPPORTED_TESTOS"/>\n' | 375 ' <supportedOn ref="SUPPORTED_TESTOS"/>\n' |
| 333 ' <elements>\n' | 376 ' <elements>\n' |
| 334 ' <decimal id="SampleIntPolicy" maxValue="2000000000" ' | 377 ' <decimal id="SampleIntPolicy" maxValue="2000000000" ' |
| 335 'valueName="SampleIntPolicy"/>\n' | 378 'valueName="SampleIntPolicy"/>\n' |
| 336 ' </elements>\n' | 379 ' </elements>\n' |
| 337 '</policy>') | 380 '</policy>') |
| 338 self.AssertXMLEquals(output, expected_output) | 381 self.AssertXMLEquals(output, expected_output) |
| 339 | 382 |
| 340 def testIntEnumPolicy(self): | 383 def testIntEnumPolicy(self): |
| 341 enum_policy = { | 384 enum_policy = { |
| 342 'name': 'SampleEnumPolicy', | 385 'name': 'SampleEnumPolicy', |
| 343 'type': 'int-enum', | 386 'type': 'int-enum', |
| 344 'items': [ | 387 'items': [ |
| 345 {'name': 'item_1', 'value': 0}, | 388 {'name': 'item_1', 'value': 0}, |
| 346 {'name': 'item_2', 'value': 1}, | 389 {'name': 'item_2', 'value': 1}, |
| 347 ] | 390 ] |
| 348 } | 391 } |
| 349 | 392 |
| 350 self._initWriterForPolicy(self.writer, enum_policy) | 393 self._initWriterForPolicy(self.writer, enum_policy) |
| 351 self.writer.WritePolicy(enum_policy) | 394 self.writer.WritePolicy(enum_policy) |
| 352 output = self.GetXMLOfChildren(self._GetPoliciesElement(self.writer._doc)) | 395 output = self.GetXMLOfChildren(self._GetPoliciesElement(self.writer._doc)) |
| 353 expected_output = ( | 396 expected_output = ( |
| 354 '<policy class="TestClass" displayName="$(string.SampleEnumPolicy)"' | 397 '<policy class="' + self.writer.GetClass(enum_policy) + '"' |
| 398 ' displayName="$(string.SampleEnumPolicy)"' |
| 355 ' explainText="$(string.SampleEnumPolicy_Explain)"' | 399 ' explainText="$(string.SampleEnumPolicy_Explain)"' |
| 356 ' key="Software\\Policies\\Test" name="SampleEnumPolicy"' | 400 ' key="Software\\Policies\\' + self._GetKey() + '"' |
| 401 ' name="SampleEnumPolicy"' |
| 357 ' presentation="$(presentation.SampleEnumPolicy)">\n' | 402 ' presentation="$(presentation.SampleEnumPolicy)">\n' |
| 358 ' <parentCategory ref="PolicyGroup"/>\n' | 403 ' <parentCategory ref="PolicyGroup"/>\n' |
| 359 ' <supportedOn ref="SUPPORTED_TESTOS"/>\n' | 404 ' <supportedOn ref="SUPPORTED_TESTOS"/>\n' |
| 360 ' <elements>\n' | 405 ' <elements>\n' |
| 361 ' <enum id="SampleEnumPolicy" valueName="SampleEnumPolicy">\n' | 406 ' <enum id="SampleEnumPolicy" valueName="SampleEnumPolicy">\n' |
| 362 ' <item displayName="$(string.item_1)">\n' | 407 ' <item displayName="$(string.SampleEnumPolicy_item_1)">\n' |
| 363 ' <value>\n' | 408 ' <value>\n' |
| 364 ' <decimal value="0"/>\n' | 409 ' <decimal value="0"/>\n' |
| 365 ' </value>\n' | 410 ' </value>\n' |
| 366 ' </item>\n' | 411 ' </item>\n' |
| 367 ' <item displayName="$(string.item_2)">\n' | 412 ' <item displayName="$(string.SampleEnumPolicy_item_2)">\n' |
| 368 ' <value>\n' | 413 ' <value>\n' |
| 369 ' <decimal value="1"/>\n' | 414 ' <decimal value="1"/>\n' |
| 370 ' </value>\n' | 415 ' </value>\n' |
| 371 ' </item>\n' | 416 ' </item>\n' |
| 372 ' </enum>\n' | 417 ' </enum>\n' |
| 373 ' </elements>\n' | 418 ' </elements>\n' |
| 374 '</policy>') | 419 '</policy>') |
| 375 self.AssertXMLEquals(output, expected_output) | 420 self.AssertXMLEquals(output, expected_output) |
| 376 | 421 |
| 377 def testStringEnumPolicy(self): | 422 def testStringEnumPolicy(self): |
| (...skipping 10 matching lines...) Expand all Loading... |
| 388 # usage inside <string> nodes is correct. | 433 # usage inside <string> nodes is correct. |
| 389 dom_impl = minidom.getDOMImplementation('') | 434 dom_impl = minidom.getDOMImplementation('') |
| 390 self.writer._doc = dom_impl.createDocument(None, 'policyDefinitions', None) | 435 self.writer._doc = dom_impl.createDocument(None, 'policyDefinitions', None) |
| 391 self.writer._active_policies_elem = self.writer._doc.documentElement | 436 self.writer._active_policies_elem = self.writer._doc.documentElement |
| 392 self.writer._active_mandatory_policy_group_name = 'PolicyGroup' | 437 self.writer._active_mandatory_policy_group_name = 'PolicyGroup' |
| 393 self.writer.WritePolicy(enum_policy) | 438 self.writer.WritePolicy(enum_policy) |
| 394 output = self.writer.GetTemplateText() | 439 output = self.writer.GetTemplateText() |
| 395 expected_output = ( | 440 expected_output = ( |
| 396 '<?xml version="1.0" ?>\n' | 441 '<?xml version="1.0" ?>\n' |
| 397 '<policyDefinitions>\n' | 442 '<policyDefinitions>\n' |
| 398 ' <policy class="TestClass" displayName="$(string.SampleEnumPolicy)"' | 443 ' <policy class="' + self.writer.GetClass(enum_policy) + '"' |
| 444 ' displayName="$(string.SampleEnumPolicy)"' |
| 399 ' explainText="$(string.SampleEnumPolicy_Explain)"' | 445 ' explainText="$(string.SampleEnumPolicy_Explain)"' |
| 400 ' key="Software\\Policies\\Test" name="SampleEnumPolicy"' | 446 ' key="Software\\Policies\\' + self._GetKey() + '"' |
| 447 ' name="SampleEnumPolicy"' |
| 401 ' presentation="$(presentation.SampleEnumPolicy)">\n' | 448 ' presentation="$(presentation.SampleEnumPolicy)">\n' |
| 402 ' <parentCategory ref="PolicyGroup"/>\n' | 449 ' <parentCategory ref="PolicyGroup"/>\n' |
| 403 ' <supportedOn ref="SUPPORTED_TESTOS"/>\n' | 450 ' <supportedOn ref="SUPPORTED_TESTOS"/>\n' |
| 404 ' <elements>\n' | 451 ' <elements>\n' |
| 405 ' <enum id="SampleEnumPolicy" valueName="SampleEnumPolicy">\n' | 452 ' <enum id="SampleEnumPolicy" valueName="SampleEnumPolicy">\n' |
| 406 ' <item displayName="$(string.item_1)">\n' | 453 ' <item displayName="$(string.SampleEnumPolicy_item_1)">\n' |
| 407 ' <value>\n' | 454 ' <value>\n' |
| 408 ' <string>one</string>\n' | 455 ' <string>one</string>\n' |
| 409 ' </value>\n' | 456 ' </value>\n' |
| 410 ' </item>\n' | 457 ' </item>\n' |
| 411 ' <item displayName="$(string.item_2)">\n' | 458 ' <item displayName="$(string.SampleEnumPolicy_item_2)">\n' |
| 412 ' <value>\n' | 459 ' <value>\n' |
| 413 ' <string>two</string>\n' | 460 ' <string>two</string>\n' |
| 414 ' </value>\n' | 461 ' </value>\n' |
| 415 ' </item>\n' | 462 ' </item>\n' |
| 416 ' </enum>\n' | 463 ' </enum>\n' |
| 417 ' </elements>\n' | 464 ' </elements>\n' |
| 418 ' </policy>\n' | 465 ' </policy>\n' |
| 419 '</policyDefinitions>') | 466 '</policyDefinitions>') |
| 420 self.AssertXMLEquals(output, expected_output) | 467 self.AssertXMLEquals(output, expected_output) |
| 421 | 468 |
| 422 def testListPolicy(self): | 469 def testListPolicy(self): |
| 423 list_policy = { | 470 list_policy = { |
| 424 'name': 'SampleListPolicy', | 471 'name': 'SampleListPolicy', |
| 425 'type': 'list', | 472 'type': 'list', |
| 426 } | 473 } |
| 427 self._initWriterForPolicy(self.writer, list_policy) | 474 self._initWriterForPolicy(self.writer, list_policy) |
| 428 self.writer.WritePolicy(list_policy) | 475 self.writer.WritePolicy(list_policy) |
| 429 output = self.GetXMLOfChildren(self._GetPoliciesElement(self.writer._doc)) | 476 output = self.GetXMLOfChildren(self._GetPoliciesElement(self.writer._doc)) |
| 430 expected_output = ( | 477 expected_output = ( |
| 431 '<policy class="TestClass" displayName="$(string.SampleListPolicy)"' | 478 '<policy class="' + self.writer.GetClass(list_policy) + '"' |
| 479 ' displayName="$(string.SampleListPolicy)"' |
| 432 ' explainText="$(string.SampleListPolicy_Explain)"' | 480 ' explainText="$(string.SampleListPolicy_Explain)"' |
| 433 ' key="Software\\Policies\\Test" name="SampleListPolicy"' | 481 ' key="Software\\Policies\\' + self._GetKey() + '"' |
| 482 ' name="SampleListPolicy"' |
| 434 ' presentation="$(presentation.SampleListPolicy)">\n' | 483 ' presentation="$(presentation.SampleListPolicy)">\n' |
| 435 ' <parentCategory ref="PolicyGroup"/>\n' | 484 ' <parentCategory ref="PolicyGroup"/>\n' |
| 436 ' <supportedOn ref="SUPPORTED_TESTOS"/>\n' | 485 ' <supportedOn ref="SUPPORTED_TESTOS"/>\n' |
| 437 ' <elements>\n' | 486 ' <elements>\n' |
| 438 ' <list id="SampleListPolicyDesc"' | 487 ' <list id="SampleListPolicyDesc"' |
| 439 ' key="Software\Policies\Test\SampleListPolicy" valuePrefix=""/>\n' | 488 ' key="Software\Policies\\' + self._GetKey() + '\SampleListPolicy"' |
| 489 ' valuePrefix=""/>\n' |
| 440 ' </elements>\n' | 490 ' </elements>\n' |
| 441 '</policy>') | 491 '</policy>') |
| 442 | 492 |
| 443 self.AssertXMLEquals(output, expected_output) | 493 self.AssertXMLEquals(output, expected_output) |
| 444 | 494 |
| 445 def testStringEnumListPolicy(self): | 495 def testStringEnumListPolicy(self): |
| 446 list_policy = { | 496 list_policy = { |
| 447 'name': 'SampleListPolicy', | 497 'name': 'SampleListPolicy', |
| 448 'type': 'string-enum-list', | 498 'type': 'string-enum-list', |
| 449 'items': [ | 499 'items': [ |
| 450 {'name': 'item_1', 'value': 'one'}, | 500 {'name': 'item_1', 'value': 'one'}, |
| 451 {'name': 'item_2', 'value': 'two'}, | 501 {'name': 'item_2', 'value': 'two'}, |
| 452 ] | 502 ] |
| 453 } | 503 } |
| 454 self._initWriterForPolicy(self.writer, list_policy) | 504 self._initWriterForPolicy(self.writer, list_policy) |
| 455 self.writer.WritePolicy(list_policy) | 505 self.writer.WritePolicy(list_policy) |
| 456 output = self.GetXMLOfChildren(self._GetPoliciesElement(self.writer._doc)) | 506 output = self.GetXMLOfChildren(self._GetPoliciesElement(self.writer._doc)) |
| 457 expected_output = ( | 507 expected_output = ( |
| 458 '<policy class="TestClass" displayName="$(string.SampleListPolicy)"' | 508 '<policy class="' + self.writer.GetClass(list_policy) + '"' |
| 509 ' displayName="$(string.SampleListPolicy)"' |
| 459 ' explainText="$(string.SampleListPolicy_Explain)"' | 510 ' explainText="$(string.SampleListPolicy_Explain)"' |
| 460 ' key="Software\\Policies\\Test" name="SampleListPolicy"' | 511 ' key="Software\\Policies\\' + self._GetKey() + '"' |
| 512 ' name="SampleListPolicy"' |
| 461 ' presentation="$(presentation.SampleListPolicy)">\n' | 513 ' presentation="$(presentation.SampleListPolicy)">\n' |
| 462 ' <parentCategory ref="PolicyGroup"/>\n' | 514 ' <parentCategory ref="PolicyGroup"/>\n' |
| 463 ' <supportedOn ref="SUPPORTED_TESTOS"/>\n' | 515 ' <supportedOn ref="SUPPORTED_TESTOS"/>\n' |
| 464 ' <elements>\n' | 516 ' <elements>\n' |
| 465 ' <list id="SampleListPolicyDesc"' | 517 ' <list id="SampleListPolicyDesc"' |
| 466 ' key="Software\Policies\Test\SampleListPolicy" valuePrefix=""/>\n' | 518 ' key="Software\Policies\\' + self._GetKey() + '\SampleListPolicy"' |
| 519 ' valuePrefix=""/>\n' |
| 467 ' </elements>\n' | 520 ' </elements>\n' |
| 468 '</policy>') | 521 '</policy>') |
| 469 | 522 |
| 470 self.AssertXMLEquals(output, expected_output) | 523 self.AssertXMLEquals(output, expected_output) |
| 471 | 524 |
| 472 def testDictionaryPolicy(self): | 525 def testDictionaryPolicy(self): |
| 473 dict_policy = { | 526 dict_policy = { |
| 474 'name': 'SampleDictionaryPolicy', | 527 'name': 'SampleDictionaryPolicy', |
| 475 'type': 'dict', | 528 'type': 'dict', |
| 476 } | 529 } |
| 477 self._initWriterForPolicy(self.writer, dict_policy) | 530 self._initWriterForPolicy(self.writer, dict_policy) |
| 478 | 531 |
| 479 self.writer.WritePolicy(dict_policy) | 532 self.writer.WritePolicy(dict_policy) |
| 480 output = self.GetXMLOfChildren(self._GetPoliciesElement(self.writer._doc)) | 533 output = self.GetXMLOfChildren(self._GetPoliciesElement(self.writer._doc)) |
| 481 expected_output = ( | 534 expected_output = ( |
| 482 '<policy class="TestClass" displayName="$(string.' | 535 '<policy class="' + self.writer.GetClass(dict_policy) + '"' |
| 483 'SampleDictionaryPolicy)"' | 536 ' displayName="$(string.SampleDictionaryPolicy)"' |
| 484 ' explainText="$(string.SampleDictionaryPolicy_Explain)"' | 537 ' explainText="$(string.SampleDictionaryPolicy_Explain)"' |
| 485 ' key="Software\\Policies\\Test" name="SampleDictionaryPolicy"' | 538 ' key="Software\\Policies\\' + self._GetKey() + '"' |
| 539 ' name="SampleDictionaryPolicy"' |
| 486 ' presentation="$(presentation.SampleDictionaryPolicy)">\n' | 540 ' presentation="$(presentation.SampleDictionaryPolicy)">\n' |
| 487 ' <parentCategory ref="PolicyGroup"/>\n' | 541 ' <parentCategory ref="PolicyGroup"/>\n' |
| 488 ' <supportedOn ref="SUPPORTED_TESTOS"/>\n' | 542 ' <supportedOn ref="SUPPORTED_TESTOS"/>\n' |
| 489 ' <elements>\n' | 543 ' <elements>\n' |
| 490 ' <text id="SampleDictionaryPolicy" maxLength="1000000"' | 544 ' <text id="SampleDictionaryPolicy" maxLength="1000000"' |
| 491 ' valueName="SampleDictionaryPolicy"/>\n' | 545 ' valueName="SampleDictionaryPolicy"/>\n' |
| 492 ' </elements>\n' | 546 ' </elements>\n' |
| 493 '</policy>') | 547 '</policy>') |
| 494 self.AssertXMLEquals(output, expected_output) | 548 self.AssertXMLEquals(output, expected_output) |
| 495 | 549 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 525 dom_impl = minidom.getDOMImplementation('') | 579 dom_impl = minidom.getDOMImplementation('') |
| 526 self.writer._doc = dom_impl.createDocument(None, 'policyDefinitions', None) | 580 self.writer._doc = dom_impl.createDocument(None, 'policyDefinitions', None) |
| 527 self.writer._active_policies_elem = self.writer._doc.documentElement | 581 self.writer._active_policies_elem = self.writer._doc.documentElement |
| 528 self.writer._active_mandatory_policy_group_name = 'PolicyGroup' | 582 self.writer._active_mandatory_policy_group_name = 'PolicyGroup' |
| 529 self.writer.WritePolicy(enum_policy_a) | 583 self.writer.WritePolicy(enum_policy_a) |
| 530 self.writer.WritePolicy(enum_policy_b) | 584 self.writer.WritePolicy(enum_policy_b) |
| 531 output = self.writer.GetTemplateText() | 585 output = self.writer.GetTemplateText() |
| 532 expected_output = ( | 586 expected_output = ( |
| 533 '<?xml version="1.0" ?>\n' | 587 '<?xml version="1.0" ?>\n' |
| 534 '<policyDefinitions>\n' | 588 '<policyDefinitions>\n' |
| 535 ' <policy class="TestClass" displayName="$(string.SampleEnumPolicy_A)"' | 589 ' <policy class="' + self.writer.GetClass(enum_policy_a) + '"' |
| 590 ' displayName="$(string.SampleEnumPolicy_A)"' |
| 536 ' explainText="$(string.SampleEnumPolicy_A_Explain)"' | 591 ' explainText="$(string.SampleEnumPolicy_A_Explain)"' |
| 537 ' key="Software\\Policies\\Test" name="SampleEnumPolicy.A"' | 592 ' key="Software\\Policies\\' + self._GetKey() + '"' |
| 593 ' name="SampleEnumPolicy.A"' |
| 538 ' presentation="$(presentation.SampleEnumPolicy.A)">\n' | 594 ' presentation="$(presentation.SampleEnumPolicy.A)">\n' |
| 539 ' <parentCategory ref="PolicyGroup"/>\n' | 595 ' <parentCategory ref="PolicyGroup"/>\n' |
| 540 ' <supportedOn ref="SUPPORTED_TESTOS"/>\n' | 596 ' <supportedOn ref="SUPPORTED_TESTOS"/>\n' |
| 541 ' <elements>\n' | 597 ' <elements>\n' |
| 542 ' <enum id="SampleEnumPolicy.A" valueName="SampleEnumPolicy.A">\n' | 598 ' <enum id="SampleEnumPolicy.A" valueName="SampleEnumPolicy.A">\n' |
| 543 ' <item displayName="$(string.tls1_2)">\n' | 599 ' <item displayName="$(string.SampleEnumPolicy_A_tls1_2)">\n' |
| 544 ' <value>\n' | 600 ' <value>\n' |
| 545 ' <string>tls1.2</string>\n' | 601 ' <string>tls1.2</string>\n' |
| 546 ' </value>\n' | 602 ' </value>\n' |
| 547 ' </item>\n' | 603 ' </item>\n' |
| 548 ' </enum>\n' | 604 ' </enum>\n' |
| 549 ' </elements>\n' | 605 ' </elements>\n' |
| 550 ' </policy>\n' | 606 ' </policy>\n' |
| 551 ' <policy class="TestClass" displayName="$(string.SampleEnumPolicy_B)"' | 607 ' <policy class="' + self.writer.GetClass(enum_policy_b) + '"' |
| 608 ' displayName="$(string.SampleEnumPolicy_B)"' |
| 552 ' explainText="$(string.SampleEnumPolicy_B_Explain)"' | 609 ' explainText="$(string.SampleEnumPolicy_B_Explain)"' |
| 553 ' key="Software\\Policies\\Test" name="SampleEnumPolicy.B"' | 610 ' key="Software\\Policies\\' + self._GetKey() + '"' |
| 611 ' name="SampleEnumPolicy.B"' |
| 554 ' presentation="$(presentation.SampleEnumPolicy.B)">\n' | 612 ' presentation="$(presentation.SampleEnumPolicy.B)">\n' |
| 555 ' <parentCategory ref="PolicyGroup"/>\n' | 613 ' <parentCategory ref="PolicyGroup"/>\n' |
| 556 ' <supportedOn ref="SUPPORTED_TESTOS"/>\n' | 614 ' <supportedOn ref="SUPPORTED_TESTOS"/>\n' |
| 557 ' <elements>\n' | 615 ' <elements>\n' |
| 558 ' <enum id="SampleEnumPolicy.B" valueName="SampleEnumPolicy.B">\n' | 616 ' <enum id="SampleEnumPolicy.B" valueName="SampleEnumPolicy.B">\n' |
| 559 ' <item displayName="$(string.tls1_2)">\n' | 617 ' <item displayName="$(string.SampleEnumPolicy_B_tls1_2)">\n' |
| 560 ' <value>\n' | 618 ' <value>\n' |
| 561 ' <string>tls1.2</string>\n' | 619 ' <string>tls1.2</string>\n' |
| 562 ' </value>\n' | 620 ' </value>\n' |
| 563 ' </item>\n' | 621 ' </item>\n' |
| 564 ' </enum>\n' | 622 ' </enum>\n' |
| 565 ' </elements>\n' | 623 ' </elements>\n' |
| 566 ' </policy>\n' | 624 ' </policy>\n' |
| 567 '</policyDefinitions>') | 625 '</policyDefinitions>') |
| 568 self.AssertXMLEquals(output, expected_output) | 626 self.AssertXMLEquals(output, expected_output) |
| 569 | 627 |
| 570 | 628 |
| 571 if __name__ == '__main__': | 629 if __name__ == '__main__': |
| 572 unittest.main() | 630 unittest.main() |
| OLD | NEW |