File: test_validate_url.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 (28 lines) | stat: -rw-r--r-- 571 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
import pytest

from briefcase.config import validate_url


@pytest.mark.parametrize(
    "url",
    [
        "https://example.com",
    ],
)
def test_valid_url(url):
    """Test that valid URLs are accepted."""
    assert validate_url(url)


@pytest.mark.parametrize(
    "url",
    [
        "not a URL!",  # Free text.
        "file:///usr/local/bin",  # File URL
        "gopher://example.com",  # URL, but not a webpage.
    ],
)
def test_invalid_url(url):
    """Test that invalid URLs are rejected."""
    with pytest.raises(ValueError):
        validate_url(url)