~allenap/maas/do-not-import-reactor-from-crochet

« back to all changes in this revision

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

[r=allenap][bug=1524007][author=allenap] Backport of r4551 from lp:maas: By default, open configuration files read-only.

This eliminates the need for locking when using the YAML-based back-end.

Show diffs side-by-side

added added

removed removed

Lines of Context:
225
225
 
226
226
    @inlineCallbacks
227
227
    def test_get_reader_converts_404s_to_tftp_error(self):
228
 
        with ClusterConfiguration.open() as config:
 
228
        with ClusterConfiguration.open_for_update() as config:
229
229
            config.cluster_uuid = factory.make_UUID()
230
230
 
231
231
        backend = TFTPBackend(
238
238
 
239
239
    @inlineCallbacks
240
240
    def test_get_reader_converts_other_exceptions_to_tftp_error(self):
241
 
        with ClusterConfiguration.open() as config:
 
241
        with ClusterConfiguration.open_for_update() as config:
242
242
            config.cluster_uuid = factory.make_UUID()
243
243
 
244
244
        exception_type = factory.make_exception_type()
267
267
        # For paths matching PXEBootMethod.match_path, TFTPBackend.get_reader()
268
268
        # returns a Deferred that will yield a BytesReader.
269
269
        cluster_uuid = factory.make_UUID()
270
 
        with ClusterConfiguration.open() as config:
 
270
        with ClusterConfiguration.open_for_update() as config:
271
271
            config.cluster_uuid = cluster_uuid
272
272
        mac = factory.make_mac_address("-")
273
273
        config_path = compose_config_path(mac)
369
369
        # arch field of the parameters (mapping from pxe to maas
370
370
        # namespace).
371
371
        cluster_uuid = factory.make_UUID()
372
 
        with ClusterConfiguration.open() as config:
 
372
        with ClusterConfiguration.open_for_update() as config:
373
373
            config.cluster_uuid = cluster_uuid
374
374
        config_path = "pxelinux.cfg/default-arm"
375
375
        backend = TFTPBackend(