Skip to content

Commit

Permalink
Add python test
Browse files Browse the repository at this point in the history
  • Loading branch information
yunhanw-google committed Dec 6, 2021
1 parent 8fe54b9 commit 01e19b0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15397,6 +15397,14 @@
"incoming": 1,
"outgoing": 0
},
{
"name": "TestEmitTestEventRequest",
"code": 20,
"mfgCode": null,
"source": "client",
"incoming": 1,
"outgoing": 0
},
{
"name": "TestSimpleOptionalArgumentRequest",
"code": 19,
Expand Down
12 changes: 12 additions & 0 deletions src/controller/python/test/test_scripts/cluster_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,17 @@ async def SendCommandWithResponse(cls, devCtrl):
if res.returnValue != 5:
raise ValueError()

@classmethod
async def SendCommandWithTestClusterEventTrigger(cls, devCtrl):
req = Clusters.TestCluster.Commands.TestEmitTestEventRequest(arg1=1)
res = await devCtrl.SendCommand(nodeid=NODE_ID, endpoint=LIGHTING_ENDPOINT_ID, payload=req)
if not isinstance(res, Clusters.TestCluster.Commands.TestEmitTestEventResponse):
logger.error(f"Unexpected response of type {type(res)} received.")
raise ValueError()
logger.info(f"Received response: {res}")
if res.returnValue != 5:
raise ValueError()

@classmethod
async def SendWriteRequest(cls, devCtrl):
res = await devCtrl.WriteAttribute(nodeid=NODE_ID,
Expand Down Expand Up @@ -234,6 +245,7 @@ async def RunTest(cls, devCtrl):
await cls.RoundTripTest(devCtrl)
await cls.RoundTripTestWithBadEndpoint(devCtrl)
await cls.SendCommandWithResponse(devCtrl)
await cls.SendCommandWithTestClusterEventTrigger(devCtrl)
await cls.SendWriteRequest(devCtrl)
await cls.TestReadAttributeRequests(devCtrl)
await cls.TestReadEventRequests(devCtrl)
Expand Down

0 comments on commit 01e19b0

Please sign in to comment.