~lutostag/ubuntu/trusty/maas/1.5.4+changelog-fix

« back to all changes in this revision

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

  • Committer: Greg Lutostanski
  • Date: 2014-08-28 19:29:56 UTC
  • Revision ID: gregory.lutostanski@canonical.com-20140828192956-dkgdyexnzpppw9mn
Bring src in line with maas release 1.5.4 (bzr 2294 from lp:maas/1.5)

Show diffs side-by-side

added added

removed removed

Lines of Context:
460
460
        matcher = MockCalledOnceWith(queue=nodegroup.uuid, args=args)
461
461
        self.assertThat(mock.apply_async, matcher)
462
462
 
 
463
    def test_probe_and_enlist_mscm_adds_mscm(self):
 
464
        nodegroup = factory.make_node_group()
 
465
        host = 'http://host'
 
466
        username = factory.make_name('user')
 
467
        password = factory.make_name('password')
 
468
        self.become_admin()
 
469
 
 
470
        mock = self.patch(nodegroup_module, 'enlist_nodes_from_mscm')
 
471
 
 
472
        response = self.client.post(
 
473
            reverse('nodegroup_handler', args=[nodegroup.uuid]),
 
474
            {
 
475
                'op': 'probe_and_enlist_mscm',
 
476
                'host': host,
 
477
                'username': username,
 
478
                'password': password,
 
479
            })
 
480
 
 
481
        self.assertEqual(
 
482
            httplib.OK, response.status_code,
 
483
            explain_unexpected_response(httplib.OK, response))
 
484
 
 
485
        args = (host, username, password)
 
486
        matcher = MockCalledOnceWith(queue=nodegroup.uuid, args=args)
 
487
        self.assertThat(mock.apply_async, matcher)
 
488
 
463
489
 
464
490
class TestNodeGroupAPIAuth(MAASServerTestCase):
465
491
    """Authorization tests for nodegroup API."""