Exemple #1
0
    def test_compare(self):
        phases = Phases()
        phasenone1 = phases.get("None")
        phasenone2 = phases.get("None")
        self.assertTrue(phasenone1 == phasenone2)

        phasedownloaded = phases.get("Downloaded")
        self.assertTrue(phasenone1 < phasedownloaded)
        self.assertTrue(phasedownloaded > phasenone1)

        phaseextracted = phases.get("Extracted")
        self.assertTrue(phaseextracted > phasedownloaded)

        phasepatched = phases.get("Patched")
        self.assertTrue(phasepatched > phaseextracted)

        phaseconfigured = phases.get("Configured")
        self.assertTrue(phaseconfigured > phasepatched)

        phasebuilt = phases.get("Built")
        self.assertTrue(phasebuilt > phaseconfigured)

        phasedestrooted = phases.get("Destrooted")
        self.assertTrue(phasedestrooted > phasebuilt)

        phaseactivated = phases.get("Activated")
        self.assertTrue(phaseactivated > phasedestrooted)
Exemple #2
0
    def test_get(self):
        phases = Phases()
        phase = phases.get("None")
        self.assertEquals("None", phase.name)

        phase = phases.get("Downloaded")
        self.assertEquals("Downloaded", phase.name)

        phase = phases.get("Extracted")
        self.assertEquals("Extracted", phase.name)

        phase = phases.get("Patched")
        self.assertEquals("Patched", phase.name)

        phase = phases.get("Configured")
        self.assertEquals("Configured", phase.name)

        phase = phases.get("Built")
        self.assertEquals("Built", phase.name)

        phase = phases.get("Destrooted")
        self.assertEquals("Destrooted", phase.name)

        phase = phases.get("Activated")
        self.assertEquals("Activated", phase.name)

        try:
            phases.get("abc")
            self.fail("phase abc doesn't exists")
        except KeyError:
            pass