File: test_validate_locale.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 (22 lines) | stat: -rw-r--r-- 826 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
from unittest.mock import PropertyMock


def test_supported_encoding(base_command, capsys, monkeypatch):
    """User is not warned for a supported encoding."""
    monkeypatch.setattr(
        type(base_command.tools), "system_encoding", PropertyMock(return_value="UTF-8")
    )
    base_command.validate_locale()
    assert "Default system encoding is not supported" not in capsys.readouterr().out


def test_unsupported_encoding(base_command, capsys, monkeypatch):
    """User is warned for an unsupported encoding on Linux."""
    base_command.tools.host_os = "Linux"
    monkeypatch.setattr(
        type(base_command.tools),
        "system_encoding",
        PropertyMock(return_value="ISO-NOPE"),
    )
    base_command.validate_locale()
    assert "Default system encoding is not supported" in capsys.readouterr().out