@@ -1739,21 +1739,37 @@ void test_user_credential_user_add_modify_delete_happy_case()
17391739
17401740 TEST_ASSERT_EQUAL_MESSAGE (SL_STATUS_OK,
17411741 status,
1742- " User add should have returned SL_STATUS_OK" );
1742+ " zwave_command_class_user_credential_add_new_user "
1743+ " should have returned SL_STATUS_OK" );
17431744 // Get user node
1744- auto user_node
1745- = attribute_store_get_first_child_by_type (endpoint_id_node,
1746- ATTRIBUTE (USER_UNIQUE_ID));
1745+ auto user_node = helper_test_and_get_node (ATTRIBUTE (USER_UNIQUE_ID));
1746+ auto operation_type_node
1747+ = helper_test_and_get_node (ATTRIBUTE (USER_OPERATION_TYPE), user_node);
1748+ TEST_ASSERT_EQUAL_MESSAGE (
1749+ USER_SET_OPERATION_TYPE_ADD,
1750+ operation_type_node.desired <user_credential_operation_type_t >(),
1751+ " Operation type mismatch for user add" );
17471752
1748- TEST_ASSERT_TRUE_MESSAGE (attribute_store_node_exists (user_node),
1749- " An user node should exist" );
1753+ zwave_frame set_frame;
1754+ set_frame.add (
1755+ static_cast <user_credential_operation_type_t >(USER_SET_OPERATION_TYPE_ADD));
1756+ set_frame.add (user_id);
1757+ set_frame.add (user_type);
1758+ set_frame.add (user_active_state);
1759+ set_frame.add (credential_rule);
1760+ set_frame.add (expiring_timeout);
1761+ set_frame.add (user_name_encoding);
1762+ set_frame.add (user_name);
1763+ helper_test_get_set_frame_happy_case (USER_SET,
1764+ operation_type_node,
1765+ set_frame);
17501766
17511767 // Create notification report frame
17521768 user_credential_modifier_type_t user_modifier_type = 2 ;
17531769 user_credential_modifier_node_id_t user_modifier_node_id = 1212 ;
17541770
1755- helper_simulate_user_report_frame (0x00 , // user added
1756- 0 , // Next user id
1771+ helper_simulate_user_report_frame (USER_SET_OPERATION_TYPE_ADD,
1772+ 0 , // Next user id
17571773 user_modifier_type,
17581774 user_modifier_node_id,
17591775 user_id,
@@ -1795,8 +1811,41 @@ void test_user_credential_user_add_modify_delete_happy_case()
17951811 user_name_encoding = 2 ;
17961812 user_name = " JACKIE CAMION TURBO PLUS" ;
17971813
1798- helper_simulate_user_report_frame (0x01 , // modify user
1799- 0 , // Next user id
1814+ status = zwave_command_class_user_credential_modify_user (endpoint_id_node,
1815+ user_id,
1816+ user_type,
1817+ credential_rule,
1818+ user_active_state,
1819+ expiring_timeout,
1820+ user_name_encoding,
1821+ user_name.c_str ());
1822+ TEST_ASSERT_EQUAL_MESSAGE (SL_STATUS_OK,
1823+ status,
1824+ " zwave_command_class_user_credential_modify_user "
1825+ " should have returned SL_STATUS_OK" );
1826+ TEST_ASSERT_EQUAL_MESSAGE (
1827+ USER_SET_OPERATION_TYPE_MODIFY,
1828+ operation_type_node.desired <user_credential_operation_type_t >(),
1829+ " Operation type mismatch for user modify" );
1830+
1831+ // Set frame
1832+ set_frame.clear ();
1833+ set_frame.add (static_cast <user_credential_operation_type_t >(
1834+ USER_SET_OPERATION_TYPE_MODIFY));
1835+ set_frame.add (user_id);
1836+ set_frame.add (user_type);
1837+ set_frame.add (user_active_state);
1838+ set_frame.add (credential_rule);
1839+ set_frame.add (expiring_timeout);
1840+ set_frame.add (user_name_encoding);
1841+ set_frame.add (user_name);
1842+ helper_test_get_set_frame_happy_case (USER_SET,
1843+ operation_type_node,
1844+ set_frame);
1845+
1846+ // Report back
1847+ helper_simulate_user_report_frame (USER_SET_OPERATION_TYPE_MODIFY,
1848+ 0 , // Next user id
18001849 user_modifier_type,
18011850 user_modifier_node_id,
18021851 user_id,
@@ -1811,8 +1860,8 @@ void test_user_credential_user_add_modify_delete_happy_case()
18111860 user_modifier_type = 5 ;
18121861 user_modifier_node_id = 12122 ;
18131862
1814- helper_simulate_user_report_frame (0x01 , // modify user
1815- 0 , // Next user id
1863+ helper_simulate_user_report_frame (USER_SET_OPERATION_TYPE_MODIFY,
1864+ 0 , // Next user id
18161865 user_modifier_type,
18171866 user_modifier_node_id,
18181867 user_id,
@@ -1833,8 +1882,22 @@ void test_user_credential_user_add_modify_delete_happy_case()
18331882 status,
18341883 " User delete should have returned SL_STATUS_OK" );
18351884
1836- helper_simulate_user_report_frame (0x02 , // modify user
1837- 0 , // Next user id
1885+ TEST_ASSERT_EQUAL_MESSAGE (
1886+ USER_SET_OPERATION_TYPE_DELETE,
1887+ operation_type_node.desired <user_credential_operation_type_t >(),
1888+ " Operation type mismatch for user delete" );
1889+
1890+ // Set frame
1891+ set_frame.clear ();
1892+ set_frame.add (static_cast <user_credential_operation_type_t >(
1893+ USER_SET_OPERATION_TYPE_DELETE));
1894+ set_frame.add (user_id);
1895+ helper_test_get_set_frame_happy_case (USER_SET,
1896+ operation_type_node,
1897+ set_frame);
1898+
1899+ helper_simulate_user_report_frame (USER_SET_OPERATION_TYPE_DELETE,
1900+ 0 , // Next user id
18381901 user_modifier_type,
18391902 user_modifier_node_id,
18401903 user_id,
@@ -2428,19 +2491,24 @@ void helper_test_credential_rejected_case(uint8_t report_type)
24282491 REPORTED_ATTRIBUTE);
24292492 auto invalid_cred_slot_node
24302493 = valid_cred_type_node.emplace_node (ATTRIBUTE (CREDENTIAL_SLOT),
2431- credential_slot ,
2494+ invalid_credential_slot ,
24322495 DESIRED_ATTRIBUTE);
2496+ invalid_cred_slot_node.emplace_node (ATTRIBUTE (CREDENTIAL_DATA),
2497+ credential_data,
2498+ DESIRED_ATTRIBUTE);
24332499
2434- helper_simulate_credential_report_frame (report_type, // Duplicate credential
2435- user_id,
2436- credential_type,
2437- credential_slot,
2438- 1 ,
2439- string_to_uint8_vector (" 1212" ),
2440- 0 ,
2441- 2 ,
2442- 0 ,
2443- 0 );
2500+ helper_simulate_credential_report_frame (
2501+ report_type,
2502+ user_id,
2503+ credential_type,
2504+ // Duplicate credential send the original slot
2505+ report_type == 0x07 ? credential_slot : invalid_credential_slot,
2506+ 1 ,
2507+ credential_data,
2508+ 0 ,
2509+ 2 ,
2510+ 0 ,
2511+ 0 );
24442512
24452513 // Here the Credential Report command should remove this not this report
24462514 TEST_ASSERT_FALSE_MESSAGE (invalid_cred_slot_node.is_valid (),
@@ -3259,7 +3327,6 @@ void test_user_credential_uuic_association_same_slot_different_user()
32593327 destination_credential_slot,
32603328 association_status);
32613329
3262-
32633330 // Test data structure
32643331 TEST_ASSERT_TRUE_MESSAGE (source_nodes.credential_type_node .is_valid (),
32653332 " Old credential type node should still exist" );
@@ -3281,18 +3348,15 @@ void test_user_credential_uuic_association_same_slot_different_user()
32813348 = helper_test_attribute_value (ATTRIBUTE (CREDENTIAL_TYPE),
32823349 credential_type,
32833350 destination_user_id_node);
3284- TEST_ASSERT_EQUAL_MESSAGE (
3285- source_nodes.credential_slot_node .parent (),
3286- destination_credential_type_node,
3287- " Old credential slot node should have new parent" );
3351+ TEST_ASSERT_EQUAL_MESSAGE (source_nodes.credential_slot_node .parent (),
3352+ destination_credential_type_node,
3353+ " Old credential slot node should have new parent" );
32883354
32893355 auto destination_credential_slot_node
32903356 = helper_test_attribute_value (ATTRIBUTE (CREDENTIAL_SLOT),
32913357 destination_credential_slot,
32923358 destination_credential_type_node);
32933359
3294-
3295-
32963360 helper_test_credential_data (destination_credential_slot_node,
32973361 credential_data,
32983362 modifier_type);
@@ -3397,10 +3461,9 @@ void test_user_credential_uuic_association_different_slot_different_user_with_ex
33973461 credential_type,
33983462 destination_user_id_node);
33993463
3400- TEST_ASSERT_EQUAL_MESSAGE (
3401- source_nodes.credential_slot_node .parent (),
3402- destination_credential_type_node,
3403- " Old credential slot node should have new parent" );
3464+ TEST_ASSERT_EQUAL_MESSAGE (source_nodes.credential_slot_node .parent (),
3465+ destination_credential_type_node,
3466+ " Old credential slot node should have new parent" );
34043467
34053468 auto destination_credential_slot_node
34063469 = helper_test_attribute_value (ATTRIBUTE (CREDENTIAL_SLOT),
0 commit comments