|
| 1 | +# Connector Account Status Lifecycle Test Action |
| 2 | + |
| 3 | +This action tests disable/enable account status changes for a baton connector that supports these capabilities. This is part of the lifecycle actions category, specifically scoped to account status (enable/disable) functionality. |
| 4 | + |
| 5 | +## Usage |
| 6 | + |
| 7 | +### Basic Usage (Default Configuration) |
| 8 | +```yaml |
| 9 | +- name: Test Account Status Changes |
| 10 | + uses: ./.github/actions/account-status-lifecycle-test |
| 11 | + with: |
| 12 | + connector: './my-connector' |
| 13 | + account-id: 'user-12345' |
| 14 | +``` |
| 15 | +
|
| 16 | +### Custom Action Names and Parameters |
| 17 | +```yaml |
| 18 | +- name: Test Account Status Changes |
| 19 | + uses: ./.github/actions/account-status-lifecycle-test |
| 20 | + with: |
| 21 | + connector: './my-connector' |
| 22 | + account-id: 'user-12345' |
| 23 | + enable-action-name: 'enableUser' # Custom action name |
| 24 | + disable-action-name: 'disableUser' # Custom action name |
| 25 | + id-parameter-name: 'user-id' # Custom parameter name (e.g., user-id, accountId, etc.) |
| 26 | +``` |
| 27 | +
|
| 28 | +### Test Only Enable Action |
| 29 | +```yaml |
| 30 | +- name: Test Enable Only |
| 31 | + uses: ./.github/actions/account-status-lifecycle-test |
| 32 | + with: |
| 33 | + connector: './my-connector' |
| 34 | + account-id: 'user-12345' |
| 35 | + test-flow: 'enable-only' # Only test enable + verification |
| 36 | +``` |
| 37 | +
|
| 38 | +### Test Only Disable Action |
| 39 | +```yaml |
| 40 | +- name: Test Disable Only |
| 41 | + uses: ./.github/actions/account-status-lifecycle-test |
| 42 | + with: |
| 43 | + connector: './my-connector' |
| 44 | + account-id: 'user-12345' |
| 45 | + test-flow: 'disable-only' # Only test disable + verification |
| 46 | +``` |
| 47 | +
|
| 48 | +### Test Enable Then Disable |
| 49 | +```yaml |
| 50 | +- name: Test Enable Then Disable |
| 51 | + uses: ./.github/actions/account-status-lifecycle-test |
| 52 | + with: |
| 53 | + connector: './my-connector' |
| 54 | + account-id: 'user-12345' |
| 55 | + test-flow: 'enable-disable' # Enable first, then disable |
| 56 | +``` |
| 57 | +
|
| 58 | +## Inputs |
| 59 | +
|
| 60 | +### Required |
| 61 | +- `connector`: Connector binary to test |
| 62 | +- `account-id`: Account ID to test status changes |
| 63 | + |
| 64 | +### Optional |
| 65 | +- `enable-action-name`: Name of the action to enable the account (default: `"enable_user"`) |
| 66 | + - Examples: `"enable_user"`, `"enableUser"`, `"activate_user"`, etc. |
| 67 | +- `disable-action-name`: Name of the action to disable the account (default: `"disable_user"`) |
| 68 | + - Examples: `"disable_user"`, `"disableUser"`, `"deactivate_user"`, etc. |
| 69 | +- `id-parameter-name`: Parameter name to send the account ID in the action (default: `"user_id"`) |
| 70 | + - Examples: `"user_id"`, `"user-id"`, `"accountId"`, `"id"`, etc. |
| 71 | + - Note: Most connectors use `"user_id"` (snake_case) as the convention |
| 72 | +- `test-flow`: Test flow to execute (default: `"disable-enable"`) |
| 73 | + - `"disable-enable"`: Disable the account, then enable it (default) |
| 74 | + - `"enable-disable"`: Enable the account, then disable it |
| 75 | + - `"enable-only"`: Only test enabling the account (with verification) |
| 76 | + - `"disable-only"`: Only test disabling the account (with verification) |
| 77 | + |
| 78 | +## What it tests |
| 79 | + |
| 80 | +The action performs account status tests based on the selected `test-flow`: |
| 81 | + |
| 82 | +### All Test Flows Include: |
| 83 | +1. **Initial Status Check**: Gets and displays the initial status of the account |
| 84 | +2. **Current Status Verification**: Verifies the current status of the account (enabled or disabled) |
| 85 | + |
| 86 | +### disable-enable (Default) |
| 87 | +3. **Disable Account**: Disables the account using the configured disable action |
| 88 | +4. **Disable Verification**: Verifies the account is now disabled |
| 89 | +5. **Enable Account**: Enables the account using the configured enable action |
| 90 | +6. **Enable Verification**: Verifies the account is now enabled |
| 91 | + |
| 92 | +### enable-disable |
| 93 | +3. **Enable Account**: Enables the account using the configured enable action |
| 94 | +4. **Enable Verification**: Verifies the account is now enabled |
| 95 | +5. **Disable Account**: Disables the account using the configured disable action |
| 96 | +6. **Disable Verification**: Verifies the account is now disabled |
| 97 | + |
| 98 | +### enable-only |
| 99 | +3. **Enable Account**: Enables the account using the configured enable action |
| 100 | +4. **Enable Verification**: Verifies the account is now enabled |
| 101 | + |
| 102 | +### disable-only |
| 103 | +3. **Disable Account**: Disables the account using the configured disable action |
| 104 | +4. **Disable Verification**: Verifies the account is now disabled |
| 105 | + |
| 106 | +## Status Detection |
| 107 | + |
| 108 | +The action checks for account status using the following logic: |
| 109 | +- Extracts status from the UserTrait annotation |
| 110 | +- Checks if status equals `STATUS_ENABLED` (the only enabled status in baton-sdk) |
| 111 | +- Any other status value is considered disabled: |
| 112 | + - `STATUS_DISABLED` - Account is disabled |
| 113 | + - `STATUS_DELETED` - Account is deleted |
| 114 | + - `STATUS_UNSPECIFIED` - Status is not specified |
| 115 | + - `unknown` - Status could not be retrieved |
| 116 | + |
| 117 | +## Customizing for Different Connectors |
| 118 | + |
| 119 | +Different connectors may use different action names and parameter names. This action allows you to configure: |
| 120 | + |
| 121 | +### Action Names |
| 122 | +- Some connectors use snake_case: `enable_user`, `disable_user` |
| 123 | +- Some connectors use camelCase: `enableUser`, `disableUser` |
| 124 | +- Some connectors use different names: `activate_user`, `deactivate_user`, etc. |
| 125 | + |
| 126 | +### Parameter Names |
| 127 | +- Most connectors use: `user_id` (snake_case) - this is the default and convention |
| 128 | +- Some connectors expect: `user-id` (kebab-case) |
| 129 | +- Some connectors expect: `accountId` or `id` |
| 130 | + |
| 131 | +### Example: Custom Connector Configuration |
| 132 | +```yaml |
| 133 | +- name: Test Custom Connector |
| 134 | + uses: ./.github/actions/account-status-lifecycle-test |
| 135 | + with: |
| 136 | + connector: './custom-connector' |
| 137 | + account-id: 'user-12345' |
| 138 | + enable-action-name: 'activateAccount' |
| 139 | + disable-action-name: 'deactivateAccount' |
| 140 | + id-parameter-name: 'accountId' |
| 141 | + test-flow: 'enable-disable' |
| 142 | +``` |
| 143 | + |
| 144 | +## When to use |
| 145 | + |
| 146 | +Use this action when you want to test that your connector properly supports: |
| 147 | +- Disabling user accounts |
| 148 | +- Enabling user accounts |
| 149 | +- Verifying status changes are reflected correctly |
| 150 | +- Proper status querying and verification |
| 151 | +- Different action naming conventions |
| 152 | +- Testing only one direction (enable or disable) when needed |
| 153 | + |
| 154 | +This action is separate from other test actions since not all connectors support account status change capabilities. It is specifically scoped to account status lifecycle actions (enable/disable), not all lifecycle actions (which may include update_profile, etc.). |
| 155 | + |
0 commit comments