File: test_DockerAppContext__run_app_context.py

package info (click to toggle)
python-briefcase 0.3.22-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,300 kB
  • sloc: python: 59,405; makefile: 57
file content (19 lines) | stat: -rw-r--r-- 678 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from contextlib import nullcontext
from unittest.mock import MagicMock

import pytest


@pytest.mark.usefixtures("mock_docker")
@pytest.mark.usefixtures("mock_docker_app_context")
def test_run_app_context(mock_tools, my_app):
    """Run app context calls X11 passthrough and returns the keywords."""
    # Mock X11 passthrough manager with the null manager
    mock_tools.docker.x11_passthrough = MagicMock(wraps=nullcontext)

    in_kwargs = {"keyword_one": "val1", "keyword_two": "val2"}

    with mock_tools[my_app].app_context.run_app_context(in_kwargs) as kwargs:
        assert kwargs == in_kwargs

    mock_tools.docker.x11_passthrough.assert_called_once_with(in_kwargs)