File: test_is_valid_bundle_identifier.py

package info (click to toggle)
python-briefcase 0.3.25-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,596 kB
  • sloc: python: 62,519; makefile: 60
file content (35 lines) | stat: -rw-r--r-- 967 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

from briefcase.config import is_valid_bundle_identifier


@pytest.mark.parametrize(
    "bundle",
    [
        "com.example",
        "com.example.more",
        "com.example42.more",
        "com.example-42.more",
        "in.example",  # Valid identifier with a country code as the TLD
        "is.example",  # Valid identifier with a country code as the TLD
        "com.example.in",  # Country codes can appear anywhere.
    ],
)
def test_valid_bundle(bundle):
    """Test that valid bundles are accepted."""
    assert is_valid_bundle_identifier(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(bundle):
    """Test that invalid bundles are rejected."""
    assert not is_valid_bundle_identifier(bundle)