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 '''Unit tests for grit.format.policy_templates.writers.doc_writer''' | 6 '''Unit tests for grit.format.policy_templates.writers.doc_writer''' |
7 | 7 |
8 | 8 |
9 import json | 9 import json |
10 import os | 10 import os |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 self.doc = dom_impl.createDocument(None, 'root', None) | 81 self.doc = dom_impl.createDocument(None, 'root', None) |
82 self.doc_root = self.doc.documentElement | 82 self.doc_root = self.doc.documentElement |
83 | 83 |
84 def testSkeleton(self): | 84 def testSkeleton(self): |
85 # Test if DocWriter creates the skeleton of the document correctly. | 85 # Test if DocWriter creates the skeleton of the document correctly. |
86 self.writer.BeginTemplate() | 86 self.writer.BeginTemplate() |
87 self.assertEquals( | 87 self.assertEquals( |
88 self.writer._main_div.toxml(), | 88 self.writer._main_div.toxml(), |
89 '<div>' | 89 '<div>' |
90 '<div>' | 90 '<div>' |
91 '<a name="top"/><br/>_test_intro<br/><br/><br/>' | 91 '<a name="top"/><br/><p>_test_intro</p><br/><br/><br/>' |
92 '<table style="style_table;">' | 92 '<table style="style_table;">' |
93 '<thead><tr style="style_tr;">' | 93 '<thead><tr style="style_tr;">' |
94 '<td style="style_td;style_td.left;style_thead td;">' | 94 '<td style="style_td;style_td.left;style_thead td;">' |
95 '_test_name_column_title' | 95 '_test_name_column_title' |
96 '</td>' | 96 '</td>' |
97 '<td style="style_td;style_td.right;style_thead td;">' | 97 '<td style="style_td;style_td.right;style_thead td;">' |
98 '_test_description_column_title' | 98 '_test_description_column_title' |
99 '</td>' | 99 '</td>' |
100 '</tr></thead>' | 100 '</tr></thead>' |
101 '<tbody/>' | 101 '<tbody/>' |
102 '</table>' | 102 '</table>' |
103 '</div>' | 103 '</div>' |
104 '<div/>' | 104 '<div/>' |
105 '</div>') | 105 '</div>') |
106 | 106 |
107 def testVersionAnnotation(self): | 107 def testVersionAnnotation(self): |
108 # Test if DocWriter creates the skeleton of the document correctly. | 108 # Test if DocWriter creates the skeleton of the document correctly. |
109 self.writer.config['version'] = '39.0.0.0' | 109 self.writer.config['version'] = '39.0.0.0' |
110 self.writer.BeginTemplate() | 110 self.writer.BeginTemplate() |
111 self.assertEquals( | 111 self.assertEquals( |
112 self.writer._main_div.toxml(), | 112 self.writer._main_div.toxml(), |
113 '<div>' | 113 '<div>' |
114 '<!--test_product version: 39.0.0.0-->' | 114 '<!--test_product version: 39.0.0.0-->' |
115 '<div>' | 115 '<div>' |
116 '<a name="top"/><br/>_test_intro<br/><br/><br/>' | 116 '<a name="top"/><br/><p>_test_intro</p><br/><br/><br/>' |
117 '<table style="style_table;">' | 117 '<table style="style_table;">' |
118 '<thead><tr style="style_tr;">' | 118 '<thead><tr style="style_tr;">' |
119 '<td style="style_td;style_td.left;style_thead td;">' | 119 '<td style="style_td;style_td.left;style_thead td;">' |
120 '_test_name_column_title' | 120 '_test_name_column_title' |
121 '</td>' | 121 '</td>' |
122 '<td style="style_td;style_td.right;style_thead td;">' | 122 '<td style="style_td;style_td.right;style_thead td;">' |
123 '_test_description_column_title' | 123 '_test_description_column_title' |
124 '</td>' | 124 '</td>' |
125 '</tr></thead>' | 125 '</tr></thead>' |
126 '<tbody/>' | 126 '<tbody/>' |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 {'value': 2, 'caption': 'Solve your problem'}, | 187 {'value': 2, 'caption': 'Solve your problem'}, |
188 {'value': 5, 'caption': 'Enable bar'}, | 188 {'value': 5, 'caption': 'Enable bar'}, |
189 ], | 189 ], |
190 'desc': '''This policy disables foo, except in case of bar. | 190 'desc': '''This policy disables foo, except in case of bar. |
191 See http://policy-explanation.example.com for more details. | 191 See http://policy-explanation.example.com for more details. |
192 ''' | 192 ''' |
193 } | 193 } |
194 self.writer._AddDescription(self.doc_root, policy) | 194 self.writer._AddDescription(self.doc_root, policy) |
195 self.assertEquals( | 195 self.assertEquals( |
196 self.doc_root.toxml(), | 196 self.doc_root.toxml(), |
197 '''<root>This policy disables foo, except in case of bar. | 197 '''<root><p>This policy disables foo, except in case of bar. |
198 See <a href="http://policy-explanation.example.com">http://policy-explanation.ex
ample.com</a> for more details. | 198 See <a href="http://policy-explanation.example.com">http://policy-explanation.ex
ample.com</a> for more details. |
199 <ul><li>0 = Disable foo</li><li>2 = Solve your problem</li><li>5 = Enable bar</l
i></ul></root>''') | 199 </p><ul><li>0 = Disable foo</li><li>2 = Solve your problem</li><li>5 = Enable ba
r</li></ul></root>''') |
200 | 200 |
201 def testAddDescriptionStringEnum(self): | 201 def testAddDescriptionStringEnum(self): |
202 # Test if URLs are replaced and choices of 'int-enum' policies are listed | 202 # Test if URLs are replaced and choices of 'int-enum' policies are listed |
203 # correctly. | 203 # correctly. |
204 policy = { | 204 policy = { |
205 'type': 'string-enum', | 205 'type': 'string-enum', |
206 'items': [ | 206 'items': [ |
207 {'value': "one", 'caption': 'Disable foo'}, | 207 {'value': "one", 'caption': 'Disable foo'}, |
208 {'value': "two", 'caption': 'Solve your problem'}, | 208 {'value': "two", 'caption': 'Solve your problem'}, |
209 {'value': "three", 'caption': 'Enable bar'}, | 209 {'value': "three", 'caption': 'Enable bar'}, |
210 ], | 210 ], |
211 'desc': '''This policy disables foo, except in case of bar. | 211 'desc': '''This policy disables foo, except in case of bar. |
212 See http://policy-explanation.example.com for more details. | 212 See http://policy-explanation.example.com for more details. |
213 ''' | 213 ''' |
214 } | 214 } |
215 self.writer._AddDescription(self.doc_root, policy) | 215 self.writer._AddDescription(self.doc_root, policy) |
216 self.assertEquals( | 216 self.assertEquals( |
217 self.doc_root.toxml(), | 217 self.doc_root.toxml(), |
218 '''<root>This policy disables foo, except in case of bar. | 218 '''<root><p>This policy disables foo, except in case of bar. |
219 See <a href="http://policy-explanation.example.com">http://policy-explanation.ex
ample.com</a> for more details. | 219 See <a href="http://policy-explanation.example.com">http://policy-explanation.ex
ample.com</a> for more details. |
220 <ul><li>"one" = Disable foo</li><li>"two" = Solve your probl
em</li><li>"three" = Enable bar</li></ul></root>''') | 220 </p><ul><li>"one" = Disable foo</li><li>"two" = Solve your p
roblem</li><li>"three" = Enable bar</li></ul></root>''') |
221 | 221 |
222 def testAddFeatures(self): | 222 def testAddFeatures(self): |
223 # Test if the list of features of a policy is handled correctly. | 223 # Test if the list of features of a policy is handled correctly. |
224 policy = { | 224 policy = { |
225 'features': { | 225 'features': { |
226 'spaceship_docking': False, | 226 'spaceship_docking': False, |
227 'dynamic_refresh': True, | 227 'dynamic_refresh': True, |
228 'can_be_recommended': True, | 228 'can_be_recommended': True, |
229 } | 229 } |
230 } | 230 } |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 '<dt style="style_dt;">_test_supported_on</dt>' | 432 '<dt style="style_dt;">_test_supported_on</dt>' |
433 '<dd>' | 433 '<dd>' |
434 '<ul style="style_ul;">' | 434 '<ul style="style_ul;">' |
435 '<li>Chrome (Windows, Mac, Linux) ...8...</li>' | 435 '<li>Chrome (Windows, Mac, Linux) ...8...</li>' |
436 '<li>Chrome (Android) ...30...</li>' | 436 '<li>Chrome (Android) ...30...</li>' |
437 '<li>Chrome (iOS) ...34...</li>' | 437 '<li>Chrome (iOS) ...34...</li>' |
438 '</ul>' | 438 '</ul>' |
439 '</dd>' | 439 '</dd>' |
440 '<dt style="style_dt;">_test_supported_features</dt>' | 440 '<dt style="style_dt;">_test_supported_features</dt>' |
441 '<dd>_test_feature_dynamic_refresh: _test_not_supported</dd>' | 441 '<dd>_test_feature_dynamic_refresh: _test_not_supported</dd>' |
442 '<dt style="style_dt;">_test_description</dt><dd>TestPolicyDesc</dd>' | 442 '<dt style="style_dt;">_test_description</dt><dd><p>TestPolicyDesc</p></dd
>' |
443 '<dt style="style_dt;">_test_example_value</dt>' | 443 '<dt style="style_dt;">_test_example_value</dt>' |
444 '<dd>0x00000000 (Windows), false (Linux), <false /> (Mac)</dd>' | 444 '<dd>0x00000000 (Windows), false (Linux), <false /> (Mac)</dd>' |
445 '</dl></root>') | 445 '</dl></root>') |
446 | 446 |
447 def testAddDictPolicyDetails(self): | 447 def testAddDictPolicyDetails(self): |
448 # Test if the definition list (<dl>) of policy details is created correctly | 448 # Test if the definition list (<dl>) of policy details is created correctly |
449 # for 'dict' policies. | 449 # for 'dict' policies. |
450 policy = { | 450 policy = { |
451 'type': 'dict', | 451 'type': 'dict', |
452 'name': 'TestPolicyName', | 452 'name': 'TestPolicyName', |
(...skipping 19 matching lines...) Expand all Loading... |
472 '<dt style="style_dt;">_test_mac_linux_pref_name</dt>' | 472 '<dt style="style_dt;">_test_mac_linux_pref_name</dt>' |
473 '<dd style="style_.monospace;">TestPolicyName</dd>' | 473 '<dd style="style_.monospace;">TestPolicyName</dd>' |
474 '<dt style="style_dt;">_test_supported_on</dt>' | 474 '<dt style="style_dt;">_test_supported_on</dt>' |
475 '<dd>' | 475 '<dd>' |
476 '<ul style="style_ul;">' | 476 '<ul style="style_ul;">' |
477 '<li>Chrome (Windows, Mac, Linux) ...8...</li>' | 477 '<li>Chrome (Windows, Mac, Linux) ...8...</li>' |
478 '</ul>' | 478 '</ul>' |
479 '</dd>' | 479 '</dd>' |
480 '<dt style="style_dt;">_test_supported_features</dt>' | 480 '<dt style="style_dt;">_test_supported_features</dt>' |
481 '<dd>_test_feature_dynamic_refresh: _test_not_supported</dd>' | 481 '<dd>_test_feature_dynamic_refresh: _test_not_supported</dd>' |
482 '<dt style="style_dt;">_test_description</dt><dd>TestPolicyDesc</dd>' | 482 '<dt style="style_dt;">_test_description</dt><dd><p>TestPolicyDesc</p></dd
>' |
483 '<dt style="style_dt;">_test_example_value</dt>' | 483 '<dt style="style_dt;">_test_example_value</dt>' |
484 '<dd>' | 484 '<dd>' |
485 '<dl style="style_dd dl;">' | 485 '<dl style="style_dd dl;">' |
486 '<dt>Windows:</dt>' | 486 '<dt>Windows:</dt>' |
487 '<dd style="style_.monospace;style_.pre;">MockKey\TestPolicyName = {
"foo": 123}</dd>' | 487 '<dd style="style_.monospace;style_.pre;">MockKey\TestPolicyName = {
"foo": 123}</dd>' |
488 '<dt>Linux:</dt>' | 488 '<dt>Linux:</dt>' |
489 '<dd style="style_.monospace;">TestPolicyName: {"foo": 123
}</dd>' | 489 '<dd style="style_.monospace;">TestPolicyName: {"foo": 123
}</dd>' |
490 '<dt>Mac:</dt>' | 490 '<dt>Mac:</dt>' |
491 '<dd style="style_.monospace;style_.pre;">' | 491 '<dd style="style_.monospace;style_.pre;">' |
492 '<key>TestPolicyName</key>\n' | 492 '<key>TestPolicyName</key>\n' |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 '<ul style="style_ul;">' | 543 '<ul style="style_ul;">' |
544 '<li>Chrome (Windows, Mac, Linux) ...8...</li>' | 544 '<li>Chrome (Windows, Mac, Linux) ...8...</li>' |
545 '<li>Chrome (Android) ...30...</li>' | 545 '<li>Chrome (Android) ...30...</li>' |
546 '<li>Chrome (iOS) ...34...</li>' | 546 '<li>Chrome (iOS) ...34...</li>' |
547 '</ul>' | 547 '</ul>' |
548 '</dd>' | 548 '</dd>' |
549 '<dt style="style_dt;">_test_supported_features</dt>' | 549 '<dt style="style_dt;">_test_supported_features</dt>' |
550 '<dd>_test_feature_mandatory: _test_not_supported,' | 550 '<dd>_test_feature_mandatory: _test_not_supported,' |
551 ' _test_feature_recommended: _test_supported,' | 551 ' _test_feature_recommended: _test_supported,' |
552 ' _test_feature_dynamic_refresh: _test_not_supported</dd>' | 552 ' _test_feature_dynamic_refresh: _test_not_supported</dd>' |
553 '<dt style="style_dt;">_test_description</dt><dd>TestPolicyDesc</dd>' | 553 '<dt style="style_dt;">_test_description</dt><dd><p>TestPolicyDesc</p></dd
>' |
554 '<dt style="style_dt;">_test_example_value</dt>' | 554 '<dt style="style_dt;">_test_example_value</dt>' |
555 '<dd>0x00000000 (Windows), false (Linux), <false /> (Mac)</dd>' | 555 '<dd>0x00000000 (Windows), false (Linux), <false /> (Mac)</dd>' |
556 '</dl></root>') | 556 '</dl></root>') |
557 | 557 |
558 def testAddPolicyNote(self): | 558 def testAddPolicyNote(self): |
559 # TODO(jkummerow): The functionality tested by this test is currently not | 559 # TODO(jkummerow): The functionality tested by this test is currently not |
560 # used for anything and will probably soon be removed. | 560 # used for anything and will probably soon be removed. |
561 # Test if nodes are correctly added to policies. | 561 # Test if nodes are correctly added to policies. |
562 policy = { | 562 policy = { |
563 'problem_href': 'http://www.example.com/5' | 563 'problem_href': 'http://www.example.com/5' |
564 } | 564 } |
565 self.writer.messages['doc_note'] = {'text': '...$6...'} | 565 self.writer.messages['doc_note'] = {'text': '...$6...'} |
566 self.writer._AddPolicyNote(self.doc_root, policy) | 566 self.writer._AddPolicyNote(self.doc_root, policy) |
567 self.assertEquals( | 567 self.assertEquals( |
568 self.doc_root.toxml(), | 568 self.doc_root.toxml(), |
569 '<root><div style="style_div.note;">...' | 569 '<root><div style="style_div.note;"><p>...' |
570 '<a href="http://www.example.com/5">http://www.example.com/5</a>' | 570 '<a href="http://www.example.com/5">http://www.example.com/5</a>' |
571 '...</div></root>') | 571 '...</p></div></root>') |
572 | 572 |
573 def testAddPolicyRow(self): | 573 def testAddPolicyRow(self): |
574 # Test if policies are correctly added to the summary table. | 574 # Test if policies are correctly added to the summary table. |
575 policy = { | 575 policy = { |
576 'name': 'PolicyName', | 576 'name': 'PolicyName', |
577 'caption': 'PolicyCaption', | 577 'caption': 'PolicyCaption', |
578 'type': 'string', | 578 'type': 'string', |
579 } | 579 } |
580 self.writer._indent_level = 3 | 580 self.writer._indent_level = 3 |
581 self.writer._AddPolicyRow(self.doc_root, policy) | 581 self.writer._AddPolicyRow(self.doc_root, policy) |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 '<dd style="style_.monospace;">PolicyName</dd>' | 636 '<dd style="style_.monospace;">PolicyName</dd>' |
637 '<dt style="style_dt;">_test_supported_on</dt>' | 637 '<dt style="style_dt;">_test_supported_on</dt>' |
638 '<dd>' | 638 '<dd>' |
639 '<ul style="style_ul;">' | 639 '<ul style="style_ul;">' |
640 '<li>Chrome (Windows, Mac) ..7..</li>' | 640 '<li>Chrome (Windows, Mac) ..7..</li>' |
641 '</ul>' | 641 '</ul>' |
642 '</dd>' | 642 '</dd>' |
643 '<dt style="style_dt;">_test_supported_features</dt>' | 643 '<dt style="style_dt;">_test_supported_features</dt>' |
644 '<dd>_test_feature_dynamic_refresh: _test_not_supported</dd>' | 644 '<dd>_test_feature_dynamic_refresh: _test_not_supported</dd>' |
645 '<dt style="style_dt;">_test_description</dt>' | 645 '<dt style="style_dt;">_test_description</dt>' |
646 '<dd>PolicyDesc</dd>' | 646 '<dd><p>PolicyDesc</p></dd>' |
647 '<dt style="style_dt;">_test_example_value</dt>' | 647 '<dt style="style_dt;">_test_example_value</dt>' |
648 '<dd>"False"</dd>' | 648 '<dd>"False"</dd>' |
649 '</dl>' | 649 '</dl>' |
650 '<a href="#top">_test_back_to_top</a>' | 650 '<a href="#top">_test_back_to_top</a>' |
651 '</div>' | 651 '</div>' |
652 '</root>') | 652 '</root>') |
653 # Test for groups. | 653 # Test for groups. |
654 self.setUp() | 654 self.setUp() |
655 policy['type'] = 'group' | 655 policy['type'] = 'group' |
656 self.writer._AddPolicySection(self.doc_root, policy) | 656 self.writer._AddPolicySection(self.doc_root, policy) |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
694 '<dd style="style_.monospace;">MockKey\\PolicyName</dd>' | 694 '<dd style="style_.monospace;">MockKey\\PolicyName</dd>' |
695 '<dt style="style_dt;">_test_supported_on</dt>' | 695 '<dt style="style_dt;">_test_supported_on</dt>' |
696 '<dd>' | 696 '<dd>' |
697 '<ul style="style_ul;">' | 697 '<ul style="style_ul;">' |
698 '<li>Chrome (Windows) ..33..</li>' | 698 '<li>Chrome (Windows) ..33..</li>' |
699 '</ul>' | 699 '</ul>' |
700 '</dd>' | 700 '</dd>' |
701 '<dt style="style_dt;">_test_supported_features</dt>' | 701 '<dt style="style_dt;">_test_supported_features</dt>' |
702 '<dd>_test_feature_dynamic_refresh: _test_not_supported</dd>' | 702 '<dd>_test_feature_dynamic_refresh: _test_not_supported</dd>' |
703 '<dt style="style_dt;">_test_description</dt>' | 703 '<dt style="style_dt;">_test_description</dt>' |
704 '<dd>PolicyDesc</dd>' | 704 '<dd><p>PolicyDesc</p></dd>' |
705 '<dt style="style_dt;">_test_example_value</dt>' | 705 '<dt style="style_dt;">_test_example_value</dt>' |
706 '<dd>0x0000007b (Windows)</dd>' | 706 '<dd>0x0000007b (Windows)</dd>' |
707 '</dl>' | 707 '</dl>' |
708 '<a href="#top">_test_back_to_top</a>' | 708 '<a href="#top">_test_back_to_top</a>' |
709 '</div>' | 709 '</div>' |
710 '</root>') | 710 '</root>') |
711 | 711 |
712 def testAddPolicySectionForMacOnly(self): | 712 def testAddPolicySectionForMacOnly(self): |
713 policy = { | 713 policy = { |
714 'name': 'PolicyName', | 714 'name': 'PolicyName', |
(...skipping 24 matching lines...) Expand all Loading... |
739 '<dd style="style_.monospace;">PolicyName</dd>' | 739 '<dd style="style_.monospace;">PolicyName</dd>' |
740 '<dt style="style_dt;">_test_supported_on</dt>' | 740 '<dt style="style_dt;">_test_supported_on</dt>' |
741 '<dd>' | 741 '<dd>' |
742 '<ul style="style_ul;">' | 742 '<ul style="style_ul;">' |
743 '<li>Chrome (Mac) ..33..</li>' | 743 '<li>Chrome (Mac) ..33..</li>' |
744 '</ul>' | 744 '</ul>' |
745 '</dd>' | 745 '</dd>' |
746 '<dt style="style_dt;">_test_supported_features</dt>' | 746 '<dt style="style_dt;">_test_supported_features</dt>' |
747 '<dd>_test_feature_dynamic_refresh: _test_not_supported</dd>' | 747 '<dd>_test_feature_dynamic_refresh: _test_not_supported</dd>' |
748 '<dt style="style_dt;">_test_description</dt>' | 748 '<dt style="style_dt;">_test_description</dt>' |
749 '<dd>PolicyDesc</dd>' | 749 '<dd><p>PolicyDesc</p></dd>' |
750 '<dt style="style_dt;">_test_example_value</dt>' | 750 '<dt style="style_dt;">_test_example_value</dt>' |
751 '<dd>123 (Mac)</dd>' | 751 '<dd>123 (Mac)</dd>' |
752 '</dl>' | 752 '</dl>' |
753 '<a href="#top">_test_back_to_top</a>' | 753 '<a href="#top">_test_back_to_top</a>' |
754 '</div>' | 754 '</div>' |
755 '</root>') | 755 '</root>') |
756 | 756 |
757 def testAddPolicySectionForLinuxOnly(self): | 757 def testAddPolicySectionForLinuxOnly(self): |
758 policy = { | 758 policy = { |
759 'name': 'PolicyName', | 759 'name': 'PolicyName', |
(...skipping 24 matching lines...) Expand all Loading... |
784 '<dd style="style_.monospace;">PolicyName</dd>' | 784 '<dd style="style_.monospace;">PolicyName</dd>' |
785 '<dt style="style_dt;">_test_supported_on</dt>' | 785 '<dt style="style_dt;">_test_supported_on</dt>' |
786 '<dd>' | 786 '<dd>' |
787 '<ul style="style_ul;">' | 787 '<ul style="style_ul;">' |
788 '<li>Chrome (Linux) ..33..</li>' | 788 '<li>Chrome (Linux) ..33..</li>' |
789 '</ul>' | 789 '</ul>' |
790 '</dd>' | 790 '</dd>' |
791 '<dt style="style_dt;">_test_supported_features</dt>' | 791 '<dt style="style_dt;">_test_supported_features</dt>' |
792 '<dd>_test_feature_dynamic_refresh: _test_not_supported</dd>' | 792 '<dd>_test_feature_dynamic_refresh: _test_not_supported</dd>' |
793 '<dt style="style_dt;">_test_description</dt>' | 793 '<dt style="style_dt;">_test_description</dt>' |
794 '<dd>PolicyDesc</dd>' | 794 '<dd><p>PolicyDesc</p></dd>' |
795 '<dt style="style_dt;">_test_example_value</dt>' | 795 '<dt style="style_dt;">_test_example_value</dt>' |
796 '<dd>123 (Linux)</dd>' | 796 '<dd>123 (Linux)</dd>' |
797 '</dl>' | 797 '</dl>' |
798 '<a href="#top">_test_back_to_top</a>' | 798 '<a href="#top">_test_back_to_top</a>' |
799 '</div>' | 799 '</div>' |
800 '</root>') | 800 '</root>') |
801 | 801 |
802 def testAddDictionaryExample(self): | 802 def testAddDictionaryExample(self): |
803 policy = { | 803 policy = { |
804 'name': 'PolicyName', | 804 'name': 'PolicyName', |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
871 ' </array>\n' | 871 ' </array>\n' |
872 ' <key>ProxyMode</key>\n' | 872 ' <key>ProxyMode</key>\n' |
873 ' <string>direct</string>\n' | 873 ' <string>direct</string>\n' |
874 ' <key>True</key>\n' | 874 ' <key>True</key>\n' |
875 ' <true/>\n' | 875 ' <true/>\n' |
876 '</dict>' | 876 '</dict>' |
877 '</dd>' | 877 '</dd>' |
878 '</dl>' | 878 '</dl>' |
879 '</root>') | 879 '</root>') |
880 | 880 |
| 881 def testParagraphs(self): |
| 882 text = 'Paragraph 1\n\nParagraph 2\n\nParagraph 3' |
| 883 self.writer._AddParagraphs(self.doc_root, text) |
| 884 self.assertEquals( |
| 885 self.doc_root.toxml(), |
| 886 '<root><p>Paragraph 1</p><p>Paragraph 2</p><p>Paragraph 3</p></root>') |
881 | 887 |
882 if __name__ == '__main__': | 888 if __name__ == '__main__': |
883 unittest.main() | 889 unittest.main() |
OLD | NEW |