Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Side by Side Diff: grit/format/policy_templates/writers/admx_writer_unittest.py

Issue 695613003: Fix duplicated strings in ADMX templates. (Closed) Base URL: https://chromium.googlesource.com/external/grit-i18n.git@master
Patch Set: added tests Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « grit/format/policy_templates/writers/admx_writer.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 grit.format.policy_templates.writers.admx_writer.""" 7 """Unittests for grit.format.policy_templates.writers.admx_writer."""
8 8
9 9
10 import os 10 import os
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 'supported_on': [ 466 'supported_on': [
467 {'platforms': ['win', 'zzz']}, {'platforms': ['aaa']} 467 {'platforms': ['win', 'zzz']}, {'platforms': ['aaa']}
468 ] 468 ]
469 })) 469 }))
470 self.assertFalse(self.writer.IsPolicySupported({ 470 self.assertFalse(self.writer.IsPolicySupported({
471 'supported_on': [ 471 'supported_on': [
472 {'platforms': ['mac', 'linux']}, {'platforms': ['aaa']} 472 {'platforms': ['mac', 'linux']}, {'platforms': ['aaa']}
473 ] 473 ]
474 })) 474 }))
475 475
476 def testStringEncodings(self):
477 enum_policy_a = {
478 'name': 'SampleEnumPolicy.A',
479 'type': 'string-enum',
480 'items': [
481 {'name': 'tls1.2', 'value': 'tls1.2'}
482 ]
483 }
484 enum_policy_b = {
485 'name': 'SampleEnumPolicy.B',
486 'type': 'string-enum',
487 'items': [
488 {'name': 'tls1.2', 'value': 'tls1.2'}
489 ]
490 }
491
492 dom_impl = minidom.getDOMImplementation('')
493 self.writer._doc = dom_impl.createDocument(None, 'policyDefinitions', None)
494 self.writer._active_policies_elem = self.writer._doc.documentElement
495 self.writer._active_mandatory_policy_group_name = 'PolicyGroup'
496 self.writer.WritePolicy(enum_policy_a)
497 self.writer.WritePolicy(enum_policy_b)
498 output = self.writer.GetTemplateText()
499 expected_output = (
500 '<?xml version="1.0" ?>\n'
501 '<policyDefinitions>\n'
502 ' <policy class="TestClass" displayName="$(string.SampleEnumPolicy_A)"'
503 ' explainText="$(string.SampleEnumPolicy_A_Explain)"'
504 ' key="Software\\Policies\\Test" name="SampleEnumPolicy.A"'
505 ' presentation="$(presentation.SampleEnumPolicy.A)">\n'
506 ' <parentCategory ref="PolicyGroup"/>\n'
507 ' <supportedOn ref="SUPPORTED_TESTOS"/>\n'
508 ' <elements>\n'
509 ' <enum id="SampleEnumPolicy.A" valueName="SampleEnumPolicy.A">\n'
510 ' <item displayName="$(string.tls1_2)">\n'
511 ' <value>\n'
512 ' <string>tls1.2</string>\n'
513 ' </value>\n'
514 ' </item>\n'
515 ' </enum>\n'
516 ' </elements>\n'
517 ' </policy>\n'
518 ' <policy class="TestClass" displayName="$(string.SampleEnumPolicy_B)"'
519 ' explainText="$(string.SampleEnumPolicy_B_Explain)"'
520 ' key="Software\\Policies\\Test" name="SampleEnumPolicy.B"'
521 ' presentation="$(presentation.SampleEnumPolicy.B)">\n'
522 ' <parentCategory ref="PolicyGroup"/>\n'
523 ' <supportedOn ref="SUPPORTED_TESTOS"/>\n'
524 ' <elements>\n'
525 ' <enum id="SampleEnumPolicy.B" valueName="SampleEnumPolicy.B">\n'
526 ' <item displayName="$(string.tls1_2)">\n'
527 ' <value>\n'
528 ' <string>tls1.2</string>\n'
529 ' </value>\n'
530 ' </item>\n'
531 ' </enum>\n'
532 ' </elements>\n'
533 ' </policy>\n'
534 '</policyDefinitions>')
535 self.AssertXMLEquals(output, expected_output)
536
476 537
477 if __name__ == '__main__': 538 if __name__ == '__main__':
478 unittest.main() 539 unittest.main()
OLDNEW
« no previous file with comments | « grit/format/policy_templates/writers/admx_writer.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698