~maas-committers/maas/1.2

« back to all changes in this revision

Viewing changes to src/provisioningserver/tests/test_tftp.py

  • Committer: Tarmac
  • Author(s): Jeroen Vermeulen
  • Date: 2012-12-12 03:55:13 UTC
  • mfrom: (1334.1.1 1.2-bug-108450)
  • Revision ID: tarmac-20121212035513-xm6d4es9f4w2qxd9
[r=julian-edwards][bug=1084507][author=jtv] Backport trunk r1391: Pass cluster uuid to pxeconfig API call, so it knows which cluster a request comes from.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 
24
24
from maastesting.factory import factory
25
25
from maastesting.testcase import TestCase
 
26
from provisioningserver import tftp as tftp_module
26
27
from provisioningserver.pxe.tftppath import compose_config_path
27
28
from provisioningserver.tests.test_kernel_opts import make_kernel_parameters
28
29
from provisioningserver.tftp import (
211
212
    def test_get_reader_config_file(self):
212
213
        # For paths matching re_config_file, TFTPBackend.get_reader() returns
213
214
        # a Deferred that will yield a BytesReader.
 
215
        cluster_uuid = factory.getRandomUUID()
 
216
        self.patch(tftp_module, 'get_cluster_uuid').return_value = (
 
217
            cluster_uuid)
214
218
        mac = factory.getRandomMACAddress(b"-")
215
219
        config_path = compose_config_path(mac)
216
220
        backend = TFTPBackend(self.make_dir(), b"http://example.com/")
240
244
            "mac": mac,
241
245
            "local": call_context["local"][0],  # address only.
242
246
            "remote": call_context["remote"][0],  # address only.
 
247
            "cluster_uuid": cluster_uuid,
243
248
            }
244
249
        observed_params = json.loads(output)
245
250
        self.assertEqual(expected_params, observed_params)