Package caldavclientlibrary :: Package protocol :: Package caldav :: Package tests :: Module test_multiget
[hide private]
[frames] | no frames]

Source Code for Module caldavclientlibrary.protocol.caldav.tests.test_multiget

  1  ## 
  2  # Copyright (c) 2006-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 caldavclientlibrary.protocol.webdav.session import Session 
 18  from caldavclientlibrary.protocol.caldav.multiget import Multiget 
 19  from StringIO import StringIO 
 20  from caldavclientlibrary.protocol.webdav.definitions import davxml 
 21  import unittest 
 22   
23 -class TestRequest(unittest.TestCase):
24
25 - def test_Method(self):
26 27 server = Session("www.example.com") 28 request = Multiget(server, "/", ()) 29 self.assertEqual(request.getMethod(), "REPORT")
30
31 -class TestRequestHeaders(unittest.TestCase):
32 pass
33
34 -class TestRequestBody(unittest.TestCase):
35
37 38 server = Session("www.example.com") 39 request = Multiget(server, "/", ("/a",)) 40 os = StringIO() 41 request.generateXML(os) 42 self.assertEqual(os.getvalue(), """<?xml version='1.0' encoding='utf-8'?> 43 <ns0:calendar-multiget xmlns:ns0="urn:ietf:params:xml:ns:caldav"> 44 <ns1:href xmlns:ns1="DAV:">/a</ns1:href> 45 </ns0:calendar-multiget> 46 """.replace("\n", "\r\n") 47 )
48
50 51 server = Session("www.example.com") 52 request = Multiget(server, "/", ("/a", "/b",)) 53 os = StringIO() 54 request.generateXML(os) 55 self.assertEqual(os.getvalue(), """<?xml version='1.0' encoding='utf-8'?> 56 <ns0:calendar-multiget xmlns:ns0="urn:ietf:params:xml:ns:caldav"> 57 <ns1:href xmlns:ns1="DAV:">/a</ns1:href> 58 <ns1:href xmlns:ns1="DAV:">/b</ns1:href> 59 </ns0:calendar-multiget> 60 """.replace("\n", "\r\n") 61 )
62
64 65 server = Session("www.example.com") 66 request = Multiget(server, "/", ("/a", "/b",), (davxml.getetag,)) 67 os = StringIO() 68 request.generateXML(os) 69 self.assertEqual(os.getvalue(), """<?xml version='1.0' encoding='utf-8'?> 70 <ns0:calendar-multiget xmlns:ns0="urn:ietf:params:xml:ns:caldav"> 71 <ns1:prop xmlns:ns1="DAV:"> 72 <ns1:getetag /> 73 </ns1:prop> 74 <ns1:href xmlns:ns1="DAV:">/a</ns1:href> 75 <ns1:href xmlns:ns1="DAV:">/b</ns1:href> 76 </ns0:calendar-multiget> 77 """.replace("\n", "\r\n") 78 )
79
81 82 server = Session("www.example.com") 83 request = Multiget(server, "/", ("/a", "/b",), (davxml.getetag, davxml.displayname,)) 84 os = StringIO() 85 request.generateXML(os) 86 self.assertEqual(os.getvalue(), """<?xml version='1.0' encoding='utf-8'?> 87 <ns0:calendar-multiget xmlns:ns0="urn:ietf:params:xml:ns:caldav"> 88 <ns1:prop xmlns:ns1="DAV:"> 89 <ns1:getetag /> 90 <ns1:displayname /> 91 </ns1:prop> 92 <ns1:href xmlns:ns1="DAV:">/a</ns1:href> 93 <ns1:href xmlns:ns1="DAV:">/b</ns1:href> 94 </ns0:calendar-multiget> 95 """.replace("\n", "\r\n") 96 )
97
98 -class TestResponse(unittest.TestCase):
99 pass
100
101 -class TestResponseHeaders(unittest.TestCase):
102 pass
103
104 -class TestResponseBody(unittest.TestCase):
105 pass
106