def test_OverwriteHeader(self): server = Session("www.example.com") request = Move(server, "/a", "http://www.example.com/b", overwrite=True) hdrs = request.generateRequestHeader() self.assertFalse("If-None-Match:" in hdrs) self.assertFalse("If-Match:" in hdrs) self.assertTrue("Overwrite: T" in hdrs) self.assertTrue("Destination: http://www.example.com/b" in hdrs)
def test_NoSpecialHeaders(self): server = Session("www.example.com") request = Move(server, "/a", "http://www.example.com/b") hdrs = request.generateRequestHeader() self.assertFalse("If-None-Match:" in hdrs) self.assertFalse("If-Match:" in hdrs) self.assertTrue("Overwrite: F" in hdrs) self.assertTrue("Destination: http://www.example.com/b" in hdrs)
def test_IfMatchHeader(self): server = Session("www.example.com") request = Move(server, "/a", "http://www.example.com/b") request.setData(etag="\"12345\"") hdrs = request.generateRequestHeader() self.assertFalse("If-None-Match:" in hdrs) self.assertTrue("If-Match: \"12345\"" in hdrs) self.assertTrue("Overwrite: F" in hdrs) self.assertTrue("Destination: http://www.example.com/b" in hdrs)
def moveResource(self, rurlFrom, rurlTo): assert(isinstance(rurlFrom, URL)) assert(isinstance(rurlTo, URL)) # Create WebDAV MOVE request = Move(self, rurlFrom.relativeURL(), rurlTo.absoluteURL()) # Process it self.runSession(request) if request.getStatusCode() not in (statuscodes.OK, statuscodes.Created, statuscodes.NoContent): self.handleHTTPError(request)
def moveResource(self, rurlFrom, rurlTo): assert (isinstance(rurlFrom, URL)) assert (isinstance(rurlTo, URL)) # Create WebDAV MOVE request = Move(self, rurlFrom.relativeURL(), rurlTo.absoluteURL()) # Process it self.runSession(request) if request.getStatusCode() not in (statuscodes.OK, statuscodes.Created, statuscodes.NoContent): self.handleHTTPError(request)
def test_Method(self): server = Session("www.example.com") request = Move(server, "/a", "http://www.example.com/b") self.assertEqual(request.getMethod(), "MOVE")