def test_get_source(self, proxy_getter, get_object_path): """Test the get_source function.""" payload_proxy = PAYLOADS.get_proxy("/my/payload") source_proxy_1 = PAYLOADS.get_proxy("/my/source/1") payload_proxy.Sources = [ "/my/source/1", "/my/source/2", "/my/source/3" ] self.assertEqual(get_source(payload_proxy), source_proxy_1) payload_proxy.Sources = ["/my/source/1"] self.assertEqual(get_source(payload_proxy), source_proxy_1) payload_proxy.Sources = [] self.assertRaises(ValueError, get_source, payload_proxy) payloads_proxy = PAYLOADS.get_proxy() payloads_proxy.CreateSource.return_value = "/my/source/4" source_proxy_4 = PAYLOADS.get_proxy("/my/source/4") get_object_path.return_value = "/my/source/4" payload_proxy.Sources = [] self.assertEqual(get_source(payload_proxy, SOURCE_TYPE_CDROM), source_proxy_4) payloads_proxy.CreateSource.assert_called_once_with(SOURCE_TYPE_CDROM) payload_proxy.SetSources.assert_called_once_with(["/my/source/4"])
def test_get_source(self, proxy_getter, get_object_path): """Test the get_source function.""" payload_proxy = PAYLOADS.get_proxy("/my/payload") source_proxy_1 = PAYLOADS.get_proxy("/my/source/1") payload_proxy.Sources = [ "/my/source/1", "/my/source/2", "/my/source/3" ] assert get_source(payload_proxy) == source_proxy_1 payload_proxy.Sources = ["/my/source/1"] assert get_source(payload_proxy) == source_proxy_1 payloads_proxy = PAYLOADS.get_proxy() payloads_proxy.CreateSource.return_value = "/my/source/4" source_proxy_4 = PAYLOADS.get_proxy("/my/source/4") get_object_path.return_value = "/my/source/4" payload_proxy.Sources = [] payload_proxy.DefaultSourceType = SOURCE_TYPE_CDROM assert get_source(payload_proxy) == source_proxy_4 payloads_proxy.CreateSource.assert_called_once_with(SOURCE_TYPE_CDROM) assert payload_proxy.Sources == ["/my/source/4"]
def get_source_proxy(self): """Get the DBus proxy of the RPM source. The default source for the DNF payload is set via the default_source option in the payload section of the Anaconda config file. :return: a DBus proxy """ return get_source(self.proxy, conf.payload.default_source)
def get_source_proxy(self): """Get the DBus proxy of the RPM source.""" return get_source(self.proxy, SOURCE_TYPE_RPM_OSTREE)
def get_source_proxy(self): """Get a DBus proxy of the current source.""" return get_source(self.proxy)