File: test_call.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 (78 lines) | stat: -rw-r--r-- 2,536 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
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
def test_open(open_command, first_app, second_app):
    """The open command can be called."""
    # Configure no command line options
    options, _ = open_command.parse_options([])

    open_command(**options)

    # The right sequence of things will be done
    assert open_command.actions == [
        # Host OS is verified
        ("verify-host",),
        # Tools are verified
        ("verify-tools",),
        # App configs have been finalized
        ("finalize-app-config", "first"),
        ("finalize-app-config", "second"),
        # App template is verified
        ("verify-app-template", "first"),
        # App tools are verified
        ("verify-app-tools", "first"),
        # open the first app
        ("open", "first"),
        # App template is verified
        ("verify-app-template", "second"),
        # App tools are verified
        ("verify-app-tools", "second"),
        # open the second app
        ("open", "second"),
    ]


def test_open_single(open_command, first_app):
    """The open command can be called to open a single app from the config."""
    # Configure no command line options
    options, _ = open_command.parse_options([])

    open_command(app=open_command.apps["first"], **options)

    # The right sequence of things will be done
    assert open_command.actions == [
        # Host OS is verified
        ("verify-host",),
        # Tools are verified
        ("verify-tools",),
        # App config has been finalized
        ("finalize-app-config", "first"),
        # App template is verified
        ("verify-app-template", "first"),
        # App tools are verified
        ("verify-app-tools", "first"),
        # open the first app
        ("open", "first"),
    ]


def test_create_before_open(open_command, tmp_path):
    """If the app doesn't exist, it will be created before opening."""
    # Configure no command line options
    options, _ = open_command.parse_options([])

    open_command(app=open_command.apps["first"], **options)

    # The right sequence of things will be done
    assert open_command.actions == [
        # Host OS is verified
        ("verify-host",),
        # Tools are verified
        ("verify-tools",),
        # App config has been finalized
        ("finalize-app-config", "first"),
        # create, then open the first app
        ("create", "first", {}),
        # App template is verified
        ("verify-app-template", "first"),
        # App tools are verified
        ("verify-app-tools", "first"),
        ("open", "first"),
    ]