2020-02-02 20:08:56 +01:00
|
|
|
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',
|
2020-02-03 00:38:23 +01:00
|
|
|
'HP_SL4540_Gen8'
|
|
|
|
])
|
2020-02-02 20:08:56 +01:00
|
|
|
def test_hp_service_tag(fixture):
|
|
|
|
dmi = parse(fixture)
|
|
|
|
server = ServerBase(dmi)
|
|
|
|
assert server.get_service_tag() == '4242'
|
2020-02-03 00:38:23 +01:00
|
|
|
|
|
|
|
|
|
|
|
@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'
|