403Webshell
Server IP : 15.235.198.142  /  Your IP : 216.73.216.235
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux ballsack 6.8.0-45-generic #45-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug 30 12:02:04 UTC 2024 x86_64
User : www-data ( 33)
PHP Version : 8.3.6
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/systemd/test/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/systemd/test/test_id128.py
import contextlib
import errno
import uuid
import pytest

from systemd import id128

@contextlib.contextmanager
def skip_oserror(code):
    try:
        yield
    except (OSError, IOError) as e:
        if e.errno == code:
            pytest.skip()
        raise


def test_randomize():
    u1 = id128.randomize()
    u2 = id128.randomize()
    assert u1 != u2

def test_get_machine():
    u1 = id128.get_machine()
    u2 = id128.get_machine()
    assert u1 == u2

def test_get_machine_app_specific():
    a1 = uuid.uuid1()
    a2 = uuid.uuid1()

    with skip_oserror(errno.ENOSYS):
        u1 = id128.get_machine_app_specific(a1)

    u2 = id128.get_machine_app_specific(a2)
    u3 = id128.get_machine_app_specific(a1)
    u4 = id128.get_machine_app_specific(a2)

    assert u1 != u2
    assert u1 == u3
    assert u2 == u4

def test_get_boot():
    u1 = id128.get_boot()
    u2 = id128.get_boot()
    assert u1 == u2

Youez - 2016 - github.com/yon3zu
LinuXploit