def set_when_initialized_source_fail_test(self, publisher):
        """Test LiveOS payload can't set new sources if the old ones are initialized."""
        source1 = self._prepare_source()
        source2 = self._prepare_source()

        path = PayloadSourceContainer.to_object_path(source1)
        path2 = PayloadSourceContainer.to_object_path(source2)

        self.live_os_interface.SetSources([path])
        source1.is_ready.return_value = True

        with self.assertRaises(SourceSetupError):
            self.live_os_interface.SetSources([path2])
Exemple #2
0
    def CreateSource(self, source_type: Str) -> ObjPath:
        """Create payload source and publish it on DBus.

        source_type could contain these values:
         - LIVE_OS_IMAGE
        """
        return PayloadSourceContainer.to_object_path(
            self.implementation.create_source(SourceType(source_type)))