Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More mock stuff #324

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions qubesadmin/tests/mock_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,12 @@ def __init__(self):
# # this system has some reasonable defaults
self._qubes['dom0'].default_dispvm = "default-dvm"

self._qubes['test-vm2'] = MockQube(name="test-vm2", qapp=self,
features={'menu-favorites': ''})
self._qubes['dom0'].features['menu-initial-page'] = 'favorites_page'
self._qubes['dom0'].features['menu-sort-running'] = '1'
self._qubes['dom0'].features['menu-position'] = 'mouse'

Comment on lines +651 to +656
Copy link
Member

@marmarek marmarek Dec 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not against it here, but wouldn't it be more convenient to have it in desktop-linux-menu, in a wrapper?
Simply add a file somewhere in tests/ directory that does:

def main():
    """
    Start the menu app
    """
    # if X is not running or other weird stuff is happening, exit with exit code
    # 6 to signal to the service that this should not be restarted
    if not Gtk.init_check()[0]:
        sys.exit(6)

    qapp = qubesadmin.tests.mock_app.MockQubesComplete()
    qapp._qubes['test-vm2'] = MockQube(name="test-vm2", qapp=qapp,
                                       features={'menu-favorites': ''})
    qapp._qubes['dom0'].features['menu-initial-page'] = 'favorites_page'
    qapp._qubes['dom0'].features['menu-sort-running'] = '1'
    qapp._qubes['dom0'].features['menu-position'] = 'mouse'
    qapp.update_vm_calls()
    dispatcher = qubesadmin.tests.mock_app.MockDispatcher(qapp)
    app = AppMenu(qapp, dispatcher)
    app.run(sys.argv)


if __name__ == '__main__':
    sys.exit(main())

self.update_vm_calls()

# also add a bunch of devices
Expand Down