netbox-agent/tests/server.py
ThomasADavis a5bc16d3b1
Adds a generic vendor for unrecognizable systems (#105)
Co-authored-by: Solvik <solvik@solvik.fr>
2020-02-03 00:38:23 +01:00

43 lines
1 KiB
Python

from netbox_agent.dmidecode import parse
from netbox_agent.server import ServerBase
from tests.conftest import parametrize_with_fixtures
@parametrize_with_fixtures('dmidecode/')
def test_init(fixture):
dmi = parse(fixture)
server = ServerBase(dmi)
assert server
@parametrize_with_fixtures(
'dmidecode/', only_filenames=[
'HP_SL4540_Gen8',
'HP_BL460c_Gen9',
'HP_DL380p_Gen8',
'HP_SL4540_Gen8'
])
def test_hp_service_tag(fixture):
dmi = parse(fixture)
server = ServerBase(dmi)
assert server.get_service_tag() == '4242'
@parametrize_with_fixtures(
'dmidecode/', only_filenames=[
'unknown.txt'
])
def test_generic_host_service_tag(fixture):
dmi = parse(fixture)
server = ServerBase(dmi)
assert server.get_service_tag() == '42'
@parametrize_with_fixtures(
'dmidecode/', only_filenames=[
'unknown.txt'
])
def test_generic_host_product_name(fixture):
dmi = parse(fixture)
server = ServerBase(dmi)
assert server.get_product_name() == 'SR'