File: 122-Methods.py

package info (click to toggle)
cherokee 0.7.2-4
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 8,808 kB
  • ctags: 6,577
  • sloc: ansic: 45,071; python: 9,628; sh: 9,468; makefile: 1,639; xml: 61; perl: 32
file content (67 lines) | stat: -rw-r--r-- 2,541 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
from base import *


class TestEntry (TestBase):
    def __init__ (self):
        TestBase.__init__ (self)
        self.expected_error = 405

CONF = """        
vserver!default!rule!1220!match = directory
vserver!default!rule!1220!match!directory = /methods_group
vserver!default!rule!1220!handler = file
"""

class Test (TestCollection):
    def __init__ (self):
        TestCollection.__init__ (self)

        self.name = "HTTP Methods"
        self.conf = CONF

    def Prepare (self, www):

        obj = self.Add (TestEntry())
        obj.request = "DELETE /methods_group/folder1 HTTP/1.1\r\n" +\
                      "Host: www.example.com\r\n" 

        obj = self.Add (TestEntry())
        obj.request = "COPY /methods_group/index.html HTTP/1.1\r\n" +\
                      "Host: www.example.com\r\n" +\
                      "Destination:  http://www.example.com/folder/index.html\r\n" +\
                      "Overwrite: T\r\n"

        obj = self.Add (TestEntry())
        obj.request = "MOVE /methods_group/folder1/ HTTP/1.1\r\n" +\
                      "Destination: http://www.example.com/pub2/folder2/\r\n" +\
                      "Host: www.example.com\r\n"

        obj = self.Add (TestEntry())
        obj.request = "POLL /methods_group/subtest/ HTTP/1.1\r\n" +\
                      "Host: www.example.com\r\n" +\
                      "Subscription-ID: 8,9,10,11,12\r\n" +\
                      "Content-Length: 0\r\n"

        obj = self.Add (TestEntry())
        obj.request = "SUBSCRIBE /methods_group/subtest HTTP/1.1\r\n" +\
                      "Host: www.example.com\r\n" +\
                      "Notification-type: Update\r\n" +\
                      "Call-Back: httpu://www.example.com:8080/510\r\n"

        obj = self.Add (TestEntry())
        obj.request = "UNSUBSCRIBE /methods_group/subtest HTTP/1.1\r\n" +\
                      "Host: www.example.com\r\n" +\
                      "Subscription-id: 16\r\n"

        obj = self.Add (TestEntry())
        obj.request = "LOCK /methods_group/docs/myfile.doc HTTP/1.1\r\n" +\
                      "Host: www.example.com\r\n" +\
                      "Timeout: Infinite, Second-4100000000\r\n" +\
                      "If: (<opaquelocktoken:e71df4fae-5dec-22d6-fea5-00a0c91e6be4>)\r\n"

        obj = self.Add (TestEntry())
        obj.request = "UNLOCK /methods_group/myfile.doc HTTP/1.1\r\n" +\
                      "Host: www.contoso.com\r\n" +\
                      "Lock-Token: <opaquelocktoken:e71d4fae-5dec-22df-fea5-00a0c93bd5eb1>\r\n"