Skip to content

Commit

Permalink
Mock get_value_store
Browse files Browse the repository at this point in the history
  • Loading branch information
jiuka committed Jun 20, 2022
1 parent bfc84c7 commit 5bf3703
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 8 deletions.
1 change: 1 addition & 0 deletions .devcontainer/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
flake8
pytest
pytest-cov
pytest-mock
requests-mock
14 changes: 12 additions & 2 deletions tests/unit/cmk/base/plugins/agent_based/test_dell_storage_disk.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,12 @@ def test_discovery_dell_storage_disk(section, result):
]
),
])
def test_check_dell_storage_disk(item, section, result):
def test_check_dell_storage_disk(item, section, result, mocker):
mocker.patch(
'cmk.base.plugins.agent_based.dell_storage_disk.get_value_store',
return_value={}
)

assert list(dell_storage_disk.check_dell_storage_disk(item, {}, section)) == result


Expand Down Expand Up @@ -293,5 +298,10 @@ def test_check_dell_storage_disk(item, section, result):
Result(state=State.CRIT, notice='Write latency: 2 milliseconds (warn/crit at 0 seconds/1 millisecond)'),
),
])
def test_check_dell_storage_disk_w_param(params, result):
def test_check_dell_storage_disk_w_param(params, result, mocker):
mocker.patch(
'cmk.base.plugins.agent_based.dell_storage_disk.get_value_store',
return_value={}
)

assert result in list(dell_storage_disk.check_dell_storage_disk(SAMPLE_DISK.name, params, [SAMPLE_DISK]))
14 changes: 12 additions & 2 deletions tests/unit/cmk/base/plugins/agent_based/test_dell_storage_port.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,12 @@ def test_discovery_dell_storage_port(section, result):
]
),
])
def test_check_dell_storage_port(item, section, result):
def test_check_dell_storage_port(item, section, result, mocker):
mocker.patch(
'cmk.base.plugins.agent_based.dell_storage_port.get_value_store',
return_value={}
)

assert list(dell_storage_port.check_dell_storage_port(item, {}, section)) == result


Expand Down Expand Up @@ -201,5 +206,10 @@ def test_check_dell_storage_port(item, section, result):
Result(state=State.CRIT, notice='Write latency: 459 microseconds (warn/crit at 50 microseconds/60 microseconds)'),
),
])
def test_check_dell_storage_port_w_param(params, result):
def test_check_dell_storage_port_w_param(params, result, mocker):
mocker.patch(
'cmk.base.plugins.agent_based.dell_storage_port.get_value_store',
return_value={}
)

assert result in list(dell_storage_port.check_dell_storage_port(SAMPLE_SECTION[1].name, params, [SAMPLE_SECTION[1]]))
14 changes: 12 additions & 2 deletions tests/unit/cmk/base/plugins/agent_based/test_dell_storage_temp.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,12 @@ def test_discovery_dell_storage_temp(section, result):
]
),
])
def test_check_dell_storage_temp(item, section, result):
def test_check_dell_storage_temp(item, section, result, mocker):
mocker.patch(
'cmk.base.plugins.agent_based.dell_storage_temp.get_value_store',
return_value={}
)

assert list(dell_storage_temp.check_dell_storage_temp(item, {}, section)) == result


Expand Down Expand Up @@ -162,5 +167,10 @@ def test_check_dell_storage_temp(item, section, result):
Result(state=State.OK, summary='Temperature: 295K'),
),
])
def test_check_dell_storage_temp_w_param(params, result):
def test_check_dell_storage_temp_w_param(params, result, mocker):
mocker.patch(
'cmk.base.plugins.agent_based.dell_storage_temp.get_value_store',
return_value={}
)

assert result in list(dell_storage_temp.check_dell_storage_temp(SAMPLE_SECTION[0].name, params, [SAMPLE_SECTION[0]]))
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,12 @@ def test_discovery_dell_storage_volume(section, result):
]
),
])
def test_check_dell_storage_volume(item, section, result):
def test_check_dell_storage_volume(item, section, result, mocker):
mocker.patch(
'cmk.base.plugins.agent_based.dell_storage_volume.get_value_store',
return_value={}
)

assert list(dell_storage_volume.check_dell_storage_volume(item, {}, section)) == result


Expand Down Expand Up @@ -197,5 +202,10 @@ def test_check_dell_storage_volume(item, section, result):
Result(state=State.CRIT, notice='Write latency: 857 microseconds (warn/crit at 500 microseconds/600 microseconds)'),
),
])
def test_check_dell_storage_volume_w_param(params, result):
def test_check_dell_storage_volume_w_param(params, result, mocker):
mocker.patch(
'cmk.base.plugins.agent_based.dell_storage_volume.get_value_store',
return_value={}
)

assert result in list(dell_storage_volume.check_dell_storage_volume(SAMPLE_SECTION[1].name, params, [SAMPLE_SECTION[1]]))

0 comments on commit 5bf3703

Please sign in to comment.