Skip to content

Commit

Permalink
Added unit test to check value error when getting incorrect machine
Browse files Browse the repository at this point in the history
  • Loading branch information
ankitintg committed Dec 8, 2023
1 parent b1ee6e8 commit 3185c8d
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/kpi/test_kpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from tests.kpi.kpi_data import AVALIBLE_KPI_JSON, KPI_DATA_VIZ_JSON
from smsdk.smsdk_entities.kpi.kpi import KPI
from mock import mock_open, MagicMock, patch
import unittest


@patch("smsdk.ma_session.Session")
Expand Down Expand Up @@ -112,6 +113,20 @@ def test_kpi_for_asset_display_name(get_client):
assert df1 == df2


def test_kpi_for_asset_incorrect_machine(get_client):
kpis = ["performance", "oee", "quality", "availability"]
# Query against machine that does not exist in the system.
query = {
"asset_selection": {
"machine_type": ["PickAndPlace"],
"machine_source": ["incorrect"],
}
}
# Expecting a value error while tring to get KPIs for incorrect machine.
with unittest.TestCase().assertRaises(ValueError) as context:
df1 = get_client.get_kpis_for_asset(**query)


def test_get_kpi_data_viz(get_client):
machine_sources = ["Nagoya - Pick and Place 6"]
kpis = ["quality"]
Expand Down

0 comments on commit 3185c8d

Please sign in to comment.