~evilnick/maas/1.2-docs-tidyup+preseed

« back to all changes in this revision

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

[r=julian-edwards][bug=][author=jameinel] Expose the new kernel options to the pxeconfig api.

Add the extra options to KernelParameters, and return them when the tftp server places its request.
Tweak the tftp server so that it adds the new parameters to the commandline.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3362
3362
        kernel_params = KernelParameters(**self.get_pxeconfig(params))
3363
3363
        self.assertEqual(params["local"], kernel_params.fs_host)
3364
3364
 
 
3365
    def test_pxeconfig_returns_extra_kernel_options(self):
 
3366
        node = factory.make_node()
 
3367
        kernel_opts = factory.getRandomString()
 
3368
        Config.objects.set_config('kernel_opts', kernel_opts)
 
3369
        mac = factory.make_mac_address(node=node)
 
3370
        params = self.get_default_params()
 
3371
        params['mac'] = mac.mac_address
 
3372
        pxe_config = self.get_pxeconfig(params)
 
3373
        self.assertEqual(kernel_opts, pxe_config['extra_opts'])
 
3374
 
 
3375
    def test_pxeconfig_returns_None_for_extra_kernel_opts(self):
 
3376
        mac = factory.make_mac_address()
 
3377
        params = self.get_default_params()
 
3378
        params['mac'] = mac.mac_address
 
3379
        pxe_config = self.get_pxeconfig(params)
 
3380
        self.assertEqual(None, pxe_config['extra_opts'])
 
3381
 
3365
3382
 
3366
3383
class TestNodeGroupsAPI(APIv10TestMixin, MultipleUsersScenarios, TestCase):
3367
3384
    scenarios = [