workflow::test::assert_case_state (public)

 workflow::test::assert_case_state -workflow_id workflow_id \
    -case_id case_id [ -user_id user_id ] \
    -expect_current_state expect_current_state \
    -expect_enabled_actions expect_enabled_actions \
    [ -expect_user_actions expect_user_actions ]

Defined in packages/workflow/tcl/test/workflow-test-procs.tcl

Make assertions about what the current state should be and what actions are enabled etc.

Switches:
-workflow_id
(required)
-case_id
(required)
-user_id
(optional)
-expect_current_state
(required)
-expect_enabled_actions
(required)
-expect_user_actions
(optional)

Partial Call Graph (max 5 caller/called nodes):
%3 workflow::test::run_bug_tracker_test workflow::test::run_bug_tracker_test (public) workflow::test::assert_case_state workflow::test::assert_case_state workflow::test::run_bug_tracker_test->workflow::test::assert_case_state aa_log aa_log (public) workflow::test::assert_case_state->aa_log aa_true aa_true (public) workflow::test::assert_case_state->aa_true util_sets_equal_p util_sets_equal_p (public) workflow::test::assert_case_state->util_sets_equal_p workflow::case::fsm::get_state_info workflow::case::fsm::get_state_info (private) workflow::test::assert_case_state->workflow::case::fsm::get_state_info workflow::case::get_available_actions workflow::case::get_available_actions (public, deprecated) workflow::test::assert_case_state->workflow::case::get_available_actions

Testcases:
No testcase defined.
Source code:
    set actual_states [list]
    foreach elm [workflow::case::fsm::get_state_info -all -case_id $case_id] {
        foreach { parent_action_id state_id } $elm {}
        lappend actual_states [workflow::state::fsm::get_element -state_id $state_id -element short_name]
    }

    if { ![aa_true "Current states should be: $expect_current_state"  [util_sets_equal_p $expect_current_state $actual_states]] } {
        aa_log "States are: $actual_states"
    }


    set enabled_actions [workflow::test::action_short_names  [workflow::case::get_enabled_actions -case_id $case_id]]
    
    if { ![aa_true "Enabled actions should be: $expect_enabled_actions"  [util_sets_equal_p $enabled_actions $expect_enabled_actions]] } {
        aa_log "Enabled actions are: $enabled_actions"
    }

    if { [info exists expect_user_actions] } { 
        if { $user_id eq "" } {
            set user_id [workflow::test::admin_owner_id]
        }
        set user_actions [workflow::test::action_short_names  [workflow::case::get_available_actions  -case_id $case_id  -user_id $user_id]]
        
        if { ![aa_true "Available user actions for user $user_id should be: $expect_user_actions"  [util_sets_equal_p $user_actions $expect_user_actions]] } {
            aa_log "Available user actions are: $user_actions"
        }
    }
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: