~allenap/maas/rpc-use-os-stuff-for-forms

« back to all changes in this revision

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

[r=rvb][bug=][author=allenap] Helper function to call GetPreseedData on the cluster from the region.

Also cleans up several implementations of make_url().

Show diffs side-by-side

added added

removed removed

Lines of Context:
442
442
            pick_cluster_controller_address(node))
443
443
 
444
444
 
445
 
def make_url(name):
446
 
    """Create a fake archive URL."""
447
 
    return "http://%s.example.com/%s/" % (
448
 
        factory.make_name(name),
449
 
        factory.make_name('path'),
450
 
        )
451
 
 
452
 
 
453
445
class TestPreseedContext(MAASServerTestCase):
454
446
    """Tests for `get_preseed_context`."""
455
447
 
467
459
    def test_get_preseed_context_archive_refs(self):
468
460
        # urlparse lowercases the hostnames. That should not have any
469
461
        # impact but for testing, create lower-case hostnames.
470
 
        main_archive = make_url('main_archive')
471
 
        ports_archive = make_url('ports_archive')
 
462
        main_archive = factory.make_url(netloc="main-archive.example.com")
 
463
        ports_archive = factory.make_url(netloc="ports-archive.example.com")
472
464
        Config.objects.set_config('main_archive', main_archive)
473
465
        Config.objects.set_config('ports_archive', ports_archive)
474
466
        nodegroup = factory.make_node_group(maas_url=factory.make_string())