File: test_validate_bundle.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 (35 lines) | stat: -rw-r--r-- 890 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
import pytest


@pytest.mark.parametrize(
    "bundle",
    [
        "com.example",
        "com.example.more",
        "com.example42.more",
        "com.example-42.more",
        "ca.example.issue1212",
        "au.example.issue1212",
        "in.example.issue1212",
        "im.glyph.and.this.is.1212",
    ],
)
def test_valid_bundle(new_command, bundle):
    """Test that valid bundles are accepted."""
    assert new_command.validate_bundle(bundle)


@pytest.mark.parametrize(
    "bundle",
    [
        "not a bundle!",  # Free text.
        "home",  # Only one section.
        "com.hello_world",  # underscore
        "com.hello,world",  # comma
        "com.hello world!",  # exclamation point
    ],
)
def test_invalid_bundle(new_command, bundle):
    """Test that invalid bundles are rejected."""
    with pytest.raises(ValueError):
        new_command.validate_bundle(bundle)