~maas-committers/maas/2.0

« back to all changes in this revision

Viewing changes to src/apiclient/tests/test_maas_client.py

  • Committer: MAAS Lander
  • Author(s): Felipe Reyes
  • Date: 2016-08-08 21:38:58 UTC
  • mfrom: (5183.1.1 maas-2.0.bzr)
  • Revision ID: maas_lander-20160808213858-cb5jzw0h697i6nx6
[r=blake-rouse][bug=1610414][author=freyes] This MP allows to use MAASClient to submit POST calls without the `op` argument in the query string, this is needed to create devices.

Show diffs side-by-side

added added

removed removed

Lines of Context:
352
352
        self.assertTrue(request["request_url"].endswith('?op=%s' % (method,)))
353
353
        self.assertEqual({'param': param, 'list_param': list_param}, content)
354
354
 
 
355
    def test_post_without_op(self):
 
356
        path = make_path()
 
357
        param = factory.make_string()
 
358
        method = None
 
359
        client = make_client()
 
360
 
 
361
        client.post(path, method, parameter=param)
 
362
        request = client.dispatcher.last_call
 
363
        post, _ = parse_headers_and_body_with_django(
 
364
            request["headers"], request["data"])
 
365
        self.assertTrue(request["request_url"].endswith(path))
 
366
        self.assertEqual({"parameter": [param]}, post)
 
367
 
355
368
    def test_put_dispatches_to_resource(self):
356
369
        path = make_path()
357
370
        client = make_client()