From fcd9b6d756e39107aa09b1ccebb496dba5bef32e Mon Sep 17 00:00:00 2001 From: James Swan <122404367+swan-amazon@users.noreply.github.com> Date: Fri, 6 Sep 2024 18:41:32 +0000 Subject: [PATCH] wip --- .../general-commissioning-server.cpp | 18 +++++++----------- src/python_testing/TC_CGEN_2_5.py | 2 +- src/python_testing/TC_CGEN_2_6.py | 10 +++++++++- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/app/clusters/general-commissioning-server/general-commissioning-server.cpp b/src/app/clusters/general-commissioning-server/general-commissioning-server.cpp index 3e7948e3eb8976..96f60a9ec2fed8 100644 --- a/src/app/clusters/general-commissioning-server/general-commissioning-server.cpp +++ b/src/app/clusters/general-commissioning-server/general-commissioning-server.cpp @@ -439,19 +439,15 @@ bool emberAfGeneralCommissioningClusterSetTCAcknowledgementsCallback( Commands::SetTCAcknowledgementsResponse::Type response; response.errorCode = CheckTermsAndConditionsAcknowledgementsState(termsAndConditionsProvider, acceptedTermsAndConditions); + CheckSuccess(termsAndConditionsProvider->SetAcceptance(acceptedTermsAndConditions), Failure); - if (CommissioningErrorEnum::kOk == response.errorCode) + if (failSafeContext.IsFailSafeArmed()) { - CheckSuccess(termsAndConditionsProvider->SetAcceptance(acceptedTermsAndConditions), Failure); - - if (failSafeContext.IsFailSafeArmed()) - { - failSafeContext.SetUpdateTermsAndConditionsHasBeenInvoked(); - } - else - { - CheckSuccess(termsAndConditionsProvider->CommitAcceptance(), Failure); - } + failSafeContext.SetUpdateTermsAndConditionsHasBeenInvoked(); + } + else + { + CheckSuccess(termsAndConditionsProvider->CommitAcceptance(), Failure); } commandObj->AddResponse(commandPath, response); diff --git a/src/python_testing/TC_CGEN_2_5.py b/src/python_testing/TC_CGEN_2_5.py index c26752deef8b3c..e430989d50ef7a 100644 --- a/src/python_testing/TC_CGEN_2_5.py +++ b/src/python_testing/TC_CGEN_2_5.py @@ -17,7 +17,7 @@ # === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 -# test-runner-run/run1/app: ${ALL_CLUSTERS_APP} +# test-runner-run/run1/app: ${TERMS_AND_CONDITIONS_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --KVS kvs1 --trace-to json:${TRACE_APP}.json diff --git a/src/python_testing/TC_CGEN_2_6.py b/src/python_testing/TC_CGEN_2_6.py index 3be02ab18affda..ff1e622fcbf3e3 100644 --- a/src/python_testing/TC_CGEN_2_6.py +++ b/src/python_testing/TC_CGEN_2_6.py @@ -17,7 +17,7 @@ # === BEGIN CI TEST ARGUMENTS === # test-runner-runs: run1 -# test-runner-run/run1/app: ${ALL_CLUSTERS_APP} +# test-runner-run/run1/app: ${TERMS_AND_CONDITIONS_APP} # test-runner-run/run1/factoryreset: True # test-runner-run/run1/quiet: True # test-runner-run/run1/app-args: --KVS kvs1 --trace-to json:${TRACE_APP}.json @@ -81,6 +81,14 @@ async def test_TC_CGEN_2_6(self): asserts.assert_equal( resp.errorCode, Clusters.GeneralCommissioning.Enums.CommissioningErrorEnum.kTCAcknowledgementsNotReceived, 'Incorrect error code') + cmd = Clusters.GeneralCommissioning.Commands.SetTCAcknowledgements(1, 0) + resp = await self.th1.SendCommand(nodeid=self.dut_node_id, endpoint=0, payload=cmd, timedRequestTimeoutMs=6000) + asserts.assert_equal(resp.errorCode, Clusters.GeneralCommissioning.Enums.CommissioningErrorEnum.kRequiredTCNotAccepted, 'Incorrect error code') + + cmd = Clusters.GeneralCommissioning.Commands.CommissioningComplete() + resp = await self.th1.SendCommand(nodeid=self.dut_node_id, endpoint=0, payload=cmd, timedRequestTimeoutMs=6000) + asserts.assert_equal( + resp.errorCode, Clusters.GeneralCommissioning.Enums.CommissioningErrorEnum.kRequiredTCNotAccepted, 'Incorrect error code') if __name__ == "__main__": default_matter_test_main({"pre_commissioning": False})