Revision 2c0be3d0
b/lib/rapi/connector.py | ||
---|---|---|
159 | 159 |
"""Returns all supported resources and their handlers. |
160 | 160 |
|
161 | 161 |
""" |
162 |
# Important note: New resources should always be added under /2. During a |
|
163 |
# discussion in July 2010 it was decided that having per-resource versions |
|
164 |
# is more flexible and future-compatible than versioning the whole remote |
|
165 |
# API. |
|
162 | 166 |
return { |
163 | 167 |
"/": R_root, |
164 | 168 |
|
... | ... | |
213 | 217 |
rlib2.R_2_instances_name_migrate, |
214 | 218 |
|
215 | 219 |
"/2/jobs": rlib2.R_2_jobs, |
216 |
re.compile(r'/2/jobs/(%s)$' % job_id_pattern):
|
|
220 |
re.compile(r"^/2/jobs/(%s)$" % job_id_pattern):
|
|
217 | 221 |
rlib2.R_2_jobs_id, |
218 |
re.compile(r'/2/jobs/(%s)/wait$' % job_id_pattern):
|
|
222 |
re.compile(r"^/2/jobs/(%s)/wait$" % job_id_pattern):
|
|
219 | 223 |
rlib2.R_2_jobs_id_wait, |
220 | 224 |
|
221 | 225 |
"/2/tags": rlib2.R_2_tags, |
b/test/docs_unittest.py | ||
---|---|---|
92 | 92 |
|
93 | 93 |
prevline = line |
94 | 94 |
|
95 |
prefix_exception = frozenset(["/", "/version", "/2"]) |
|
96 |
|
|
95 | 97 |
undocumented = [] |
96 | 98 |
|
97 | 99 |
for key, handler in resources.iteritems(): |
98 | 100 |
# Regex objects |
99 | 101 |
if hasattr(key, "match"): |
102 |
self.assert_(key.pattern.startswith("^/2/"), |
|
103 |
msg="Pattern %r does not start with '^/2/'" % key.pattern) |
|
104 |
|
|
100 | 105 |
found = False |
101 | 106 |
for title in titles: |
102 | 107 |
if (title.startswith("``") and |
... | ... | |
107 | 112 |
|
108 | 113 |
if not found: |
109 | 114 |
# TODO: Find better way of identifying resource |
110 |
undocumented.append(str(handler)) |
|
115 |
undocumented.append(key.pattern) |
|
116 |
|
|
117 |
else: |
|
118 |
self.assert_(key.startswith("/2/") or key in prefix_exception, |
|
119 |
msg="Path %r does not start with '/2/'" % key) |
|
111 | 120 |
|
112 |
elif ("``%s``" % key) not in titles:
|
|
113 |
undocumented.append(key) |
|
121 |
if ("``%s``" % key) not in titles:
|
|
122 |
undocumented.append(key)
|
|
114 | 123 |
|
115 | 124 |
self.failIf(undocumented, |
116 | 125 |
msg=("Missing RAPI resource documentation for %s" % |
Also available in: Unified diff