Ejemplo n.º 1
0
 def _get_data(self):
     """Create the RPM OSTree configuration data."""
     data = RPMOSTreeConfigurationData()
     data.url = "url"
     data.osname = "osname"
     data.ref = "ref"
     data.remote = "remote"
     return data
Ejemplo n.º 2
0
 def process_kickstart(self, data):
     """Process the kickstart data."""
     configuration = RPMOSTreeConfigurationData()
     configuration.osname = data.ostreesetup.osname
     configuration.remote = data.ostreesetup.remote
     configuration.url = data.ostreesetup.url
     configuration.ref = data.ostreesetup.ref
     configuration.gpg_verification_enabled = not data.ostreesetup.nogpg
     self.set_configuration(configuration)
Ejemplo n.º 3
0
def _make_config_data():
    """Create OSTree configuration data for testing

    :return RPMOSTreeConfigurationData: a data instance with all fields filled
    """
    data = RPMOSTreeConfigurationData()
    data.url = "url"
    data.osname = "osname"
    data.gpg_verification_enabled = True
    data.ref = "ref"
    data.remote = "remote"
    return data
Ejemplo n.º 4
0
    def _execute_run_once(self, use_sysroot, gpg_verify, verify_ssl,
                          gio_file_mock, conf_mock, sysroot_mock):
        new_mock = sysroot_mock.new()
        repo_mock = MagicMock()
        new_mock.get_repo.return_value = [None, repo_mock]
        conf_mock.payload.verify_ssl = verify_ssl
        path_mock = gio_file_mock.new_for_path()

        data = RPMOSTreeConfigurationData()
        data.url = "url"
        data.osname = "osname"
        data.gpg_verification_enabled = gpg_verify
        data.ref = "ref"
        data.remote = "remote"

        task = ChangeOSTreeRemoteTask(data, use_sysroot, "/physroot")
        task.run()

        repo_mock.remote_change.assert_called_once()
        the_call = repo_mock.remote_change.mock_calls[0]
        name, args, kwargs = the_call
        print(the_call, name, args, kwargs)
        self.assertEqual(len(args), 6)

        if use_sysroot:
            self.assertEqual(args[0], path_mock)
        else:
            self.assertEqual(args[0], None)
        self.assertEqual(args[2], "remote")
        self.assertEqual(args[3], "url")

        expected = {}
        if not gpg_verify:
            expected["gpg-verify"] = False
        if not verify_ssl:
            expected["tls-permissive"] = True
        var = args[4]
        self.assertEqual(type(var), Variant)
        self.assertDictEqual(var.unpack(), expected)