import pytest


pytestmark = pytest.mark.usefixtures("master", "minion_ready")


def test_get_cpuarch(caller_client):
    assert caller_client.cmd('grains.get', 'cpuarch') == 'x86_64'

@@ -1,8 +1,18 @@
+import re%0A
 import p
@@ -17,16 +17,47 @@
  pytest%0A
+from utils import check_output%0A
 %0A%0Apytest
@@ -119,107 +119,1814 @@
 )%0A%0A%0A
-def test_get_cpuarch(caller_client):%0A    assert caller_client.cmd('grains.get', 'cpuarch') == 'x86_64'
+@pytest.fixture(scope=%22session%22)%0Adef os_release(request):%0A    info = dict()%0A    with open('/etc/os-release', 'rb') as f:%0A        info.update(%0A            dict(%0A                %5Bit.strip().replace('%22', '').split('=') for it in f.readlines()%5D%0A            )%0A        )%0A    return info%0A%0A%0A@pytest.fixture(scope=%22session%22)%0Adef suse_release(request):%0A    info = dict()%0A    with open('/etc/SuSE-release', 'rb') as f:%0A        for line in f.readlines():%0A            match = re.match('(%5Ba-zA-Z%5D+)%5Cs*=%5Cs*(%5Cd+)', line)%0A            if match:%0A                info.update(%5Bmatch.groups()%5D)%0A    return info%0A%0A%0Adef test_get_cpuarch(caller_client):%0A    assert caller_client.cmd('grains.get', 'cpuarch') == 'x86_64'%0A%0A%0Adef test_get_os(caller_client):%0A    assert caller_client.cmd('grains.get', 'os') == %22SUSE%22%0A%0A%0Adef test_get_items(caller_client):%0A    assert caller_client.cmd('grains.get', 'items') == ''%0A%0A%0Adef test_get_os_family(caller_client):%0A    assert caller_client.cmd('grains.get', 'os_family') == 'Suse'%0A%0A%0Adef test_get_oscodename(env, caller_client, os_release):%0A    assert caller_client.cmd('grains.get', 'oscodename') == os_release%5B'PRETTY_NAME'%5D%0A%0A%0Adef test_get_osfullname(env, caller_client, os_release):%0A    assert caller_client.cmd('grains.get', 'osfullname') == os_release%5B'NAME'%5D%0A%0A%0Adef test_get_osarch(env, caller_client):%0A    expected = check_output(%5B'rpm', '--eval', '%25%7B_host_cpu%7D'%5D).strip()%0A    assert caller_client.cmd('grains.get', 'osarch') == expected%0A%0A%0Adef test_get_osrelease(env, caller_client, os_release):%0A    assert caller_client.cmd('grains.get', 'osrelease') == os_release%5B'VERSION_ID'%5D%0A%0A%0Adef test_get_osrelease_info(env, caller_client, suse_release):%0A    expected = (int(suse_release%5B'VERSION'%5D), int(suse_release%5B'PATCHLEVEL'%5D))%0A    assert caller_client.cmd('grains.get', 'osrelease_info') == expected
 %0A

Add grains tests