File: test_LinuxDeploy__is_elf_file.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 (25 lines) | stat: -rw-r--r-- 971 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
from tests.integrations.linuxdeploy.utils import create_mock_appimage


def test_is_elf_header_positive_detection(linuxdeploy, tmp_path):
    """File with an ELF Header is identified as an ELF file."""
    create_mock_appimage(appimage_path=tmp_path / "tools/linuxdeploy-i386.AppImage")
    assert linuxdeploy.is_elf_file() is True


def test_is_elf_header_negative_detection(linuxdeploy, tmp_path):
    """File without an ELF Header is not identified as an ELF file."""
    create_mock_appimage(
        appimage_path=tmp_path / "tools/linuxdeploy-i386.AppImage",
        mock_appimage_kind="corrupt",
    )
    assert linuxdeploy.is_elf_file() is False


def test_is_elf_header_empty_file(linuxdeploy, tmp_path):
    """Empty file is not identified as an ELF file without any errors."""
    create_mock_appimage(
        appimage_path=tmp_path / "tools/linuxdeploy-i386.AppImage",
        mock_appimage_kind="empty",
    )
    assert linuxdeploy.is_elf_file() is False