Пример #1
0
    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)
Пример #2
0
    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)
Пример #3
0
    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)
Пример #4
0
    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)
Пример #5
0
    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)
Пример #6
0
    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)
Пример #7
0
    def test_Method(self):

        server = Session("www.example.com")
        request = Move(server, "/a", "http://www.example.com/b")
        self.assertEqual(request.getMethod(), "MOVE")
Пример #8
0
    def test_Method(self):

        server = Session("www.example.com")
        request = Move(server, "/a", "http://www.example.com/b")
        self.assertEqual(request.getMethod(), "MOVE")