Package caldavclientlibrary :: Package admin :: Package xmlaccounts :: Package tests :: Module utils
[hide private]
[frames] | no frames]

Source Code for Module caldavclientlibrary.admin.xmlaccounts.tests.utils

 1  ## 
 2  # Copyright (c) 2007-2016 Apple Inc. All rights reserved. 
 3  # 
 4  # Licensed under the Apache License, Version 2.0 (the "License"); 
 5  # you may not use this file except in compliance with the License. 
 6  # You may obtain a copy of the License at 
 7  # 
 8  # http://www.apache.org/licenses/LICENSE-2.0 
 9  # 
10  # Unless required by applicable law or agreed to in writing, software 
11  # distributed under the License is distributed on an "AS IS" BASIS, 
12  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
13  # See the License for the specific language governing permissions and 
14  # limitations under the License. 
15  ## 
16   
17  from StringIO import StringIO 
18  from caldavclientlibrary.admin.xmlaccounts.record import XMLRecord 
19  from caldavclientlibrary.protocol.utils.xmlhelpers import BetterElementTree 
20  from xml.etree.ElementTree import XML 
21   
22  import unittest 
23   
24 -class TestCommon(unittest.TestCase):
25
26 - def checkXML(self, x):
27 28 x = x.replace("\n", "\r\n") 29 30 # Parse the XML data 31 a = XMLRecord() 32 a.parseXML(XML(x)) 33 34 # Generate the XML data 35 node = a.writeXML() 36 os = StringIO() 37 xmldoc = BetterElementTree(node) 38 xmldoc.writeUTF8(os) 39 40 # Verify data 41 self.assertEqual(os.getvalue(), x)
42