Пример #1
0
def test_no_name():
    data = {}
    normalize(data)
    assert 'name' not in data
    assert 'version' not in data
    assert 'kernel_version' not in data
    assert 'raw_description' not in data
Пример #2
0
def test_version_not_overwritten():
    data = {
        'version': 'Properly defined version',
        'raw_description': 'Linux 4.4.0'
    }
    normalize(data)
    assert data['version'] == 'Properly defined version'
Пример #3
0
def test_darwin():
    data = {
        'raw_description':
        'Darwin 17.5.0 Darwin Kernel Version 17.5.0: Mon Mar  5 22:24:32 PST 2018; root:xnu-4570.51.1~1/RELEASE_X86_64'
    }
    normalize(data)
    assert data['name'] == 'Darwin'
    assert data['kernel_version'] == '17.5.0'
Пример #4
0
def test_wsl_ubuntu():
    data = {
        'raw_description':
        'Linux 4.4.0-43-Microsoft #1-Microsoft Wed Dec 31 14:42:53 PST 2014'
    }
    normalize(data)
    assert data['name'] == 'Linux'
    assert data['kernel_version'] == '4.4.0'
Пример #5
0
def test_centos_runtime_info():
    data = {
        'raw_description':
        'Linux 3.10.0-693.21.1.el7.x86_64 #1 SMP Wed Mar 7 19:03:37 UTC 2018'
    }
    normalize(data)
    assert data['name'] == 'Linux'
    assert data['kernel_version'] == '3.10.0'
Пример #6
0
def test_name_not_overwritten():
    data = {'name': 'Properly defined name', 'raw_description': 'Linux 4.4.0'}
    normalize(data)
    assert data['name'] == 'Properly defined name'
Пример #7
0
def test_windows_7_or_server_2008():
    data = {'raw_description': 'Microsoft Windows NT 6.1.7601 Service Pack 1'}
    normalize(data)
    assert data['name'] == 'Windows'
    assert data['version'] == '6.1.7601'
Пример #8
0
def test_centos_os_version():
    data = {'raw_description': 'Unix 3.10.0.693'}
    normalize(data)
    assert data['name'] == 'Unix'
    assert data['kernel_version'] == '3.10.0.693'
Пример #9
0
def test_macos():
    data = {'raw_description': 'Unix 17.5.0.0'}
    normalize(data)
    assert data['name'] == 'Unix'
    assert data['kernel_version'] == '17.5.0'
Пример #10
0
def test_windows_10():
    data = {'raw_description': 'Microsoft Windows 10.0.16299'}
    normalize(data)
    assert data['name'] == 'Windows'
    assert data['version'] == '10.0.16299'
Пример #11
0
def test_windows_8_or_server_2012_or_later():
    data = {'raw_description': 'Microsoft Windows NT 6.2.9200.0'}
    normalize(data)
    assert data['name'] == 'Windows'
    assert data['version'] == '6.2.9200'
Пример #12
0
 def __init__(self, alias, data):
     normalize(data)
     super(OsContextType, self).__init__(alias, data)