~ubuntu-branches/ubuntu/lucid/landscape-client/lucid

« back to all changes in this revision

Viewing changes to landscape/package/tests/test_changer.py

  • Committer: Bazaar Package Importer
  • Author(s): Free Ekanayaka
  • Date: 2009-12-16 10:50:05 UTC
  • mfrom: (1.2.2 upstream)
  • mto: This revision was merged to the branch mainline in revision 27.
  • Revision ID: james.westby@ubuntu.com-20091216105005-bmki8i2of1dmcdkc
Tags: 1.4.0-0ubuntu0.9.10.0
* New upstream release (LP: #497351)

* Bug fixes:
  - Fix landscape daemons fail to start when too many groups are
    available (LP: #456124)
  - Fix landscape programs wake up far too much. (LP: #340843)
  - Fix Package manager fails with 'no such table: task' (LP #465846)
  - Fix test suite leaving temporary files around (LP #476418)
  - Fix the 1hr long wait for user data to be uploaded following a
    resynchronisation (LP #369000)

* Add support for Ubuntu release upgrades:
  - Add helper function to fetch many files at once (LP: #450629)
  - Handle release-upgrade messages in the packagemanager
    plugin (LP: #455217)
  - Add a release-upgrader task handler (LP: #462543)
  - Support upgrade-tool environment variables (LP: #463321)

* Add initial support for Smart package locking:
  - Detect and report changes about Smart package locks (#488108)

* Packaging fixes:
  - Turn unnecessary Pre-Depends on python-gobject into a regular Depends
  - If it's empty, remove /etc/landscape upon purge

Show diffs side-by-side

added added

removed removed

Lines of Context:
419
419
                              "REPORTER RUN")
420
420
        return result.addCallback(got_result)
421
421
 
 
422
    def test_spawn_reporter_after_running_with_config(self):
 
423
        """The changer passes the config to the reporter when running it."""
 
424
        self.config.config = "test.conf"
 
425
        output_filename = self.makeFile("REPORTER NOT RUN")
 
426
        reporter_filename = self.makeFile("#!/bin/sh\necho ARGS $@ > %s" %
 
427
                                          output_filename)
 
428
        os.chmod(reporter_filename, 0755)
 
429
 
 
430
        find_command_mock = self.mocker.replace(
 
431
            "landscape.package.reporter.find_reporter_command")
 
432
        find_command_mock()
 
433
        self.mocker.result(reporter_filename)
 
434
        self.mocker.replay()
 
435
 
 
436
        # Add a task that will do nothing besides producing an answer.
 
437
        # The reporter is only spawned if at least one task was handled.
 
438
        self.store.add_task("changer", {"type": "change-packages",
 
439
                                        "operation-id": 123})
 
440
 
 
441
        result = self.changer.run()
 
442
 
 
443
        def got_result(result):
 
444
            self.assertEquals(open(output_filename).read().strip(),
 
445
                              "ARGS -c test.conf")
 
446
        return result.addCallback(got_result)
 
447
 
422
448
    def test_set_effective_uid_and_gid_when_running_as_root(self):
423
449
        """
424
450
        After the package changer has run, we want the package-reporter to run