~gz/maas/1.2_add_db_kernel_params

« back to all changes in this revision

Viewing changes to src/maasserver/tests/test_apidoc.py

[r=allenap][bug=1059645][author=allenap] Backport of lp:maas revision 1324:

In the API description, make handler URIs absolute with respect to the request.

Previously, DEFAULT_MAAS_URL was always used.

Show diffs side-by-side

added added

removed removed

Lines of Context:
203
203
        observed = describe_handler(ExampleHandler)
204
204
        # The description contains several entries.
205
205
        self.assertSetEqual(
206
 
            {"actions", "doc", "name", "params", "uri"},
 
206
            {"actions", "doc", "name", "params", "path"},
207
207
            set(observed))
208
208
        self.assertEqual(ExampleHandler.__doc__, observed["doc"])
209
209
        self.assertEqual(ExampleHandler.__name__, observed["name"])
231
231
            }
232
232
        self.assertSetEqual(expected_actions, observed_actions)
233
233
        self.assertSetEqual({"system_id"}, set(description["params"]))
234
 
        # The URI is a URI Template <http://tools.ietf.org/html/rfc6570>, the
 
234
        # The path is a URI Template <http://tools.ietf.org/html/rfc6570>, the
235
235
        # components of which correspond to the parameters declared.
236
236
        self.assertEqual(
237
 
            "http://example.com/api/1.0/nodes/{system_id}/",
238
 
            description["uri"])
 
237
            "/api/1.0/nodes/{system_id}/",
 
238
            description["path"])
239
239
 
240
240
    def test_describe_resource_anonymous_resource(self):
241
241
        # When the resource does not require authentication, any configured