|
257 | 257 | print('execute_sql did not timeout')
|
258 | 258 | except Timeout:
|
259 | 259 | print('Caught Timeout')
|
| 260 | + |
| 261 | + |
| 262 | +################### |
| 263 | +# Test QC State Definitions |
| 264 | +################### |
| 265 | + |
| 266 | +# Create new QC state definitions |
| 267 | +qcstates = [{ |
| 268 | + 'label': 'needs verification', |
| 269 | + 'description': 'please look at this', |
| 270 | + 'publicData': False |
| 271 | + }, { |
| 272 | + 'label': 'approved', |
| 273 | + 'publicData': True |
| 274 | +}] |
| 275 | +result = insert_rows(server_context, 'core', 'qcstate', qcstates) |
| 276 | +for row in result['rows']: |
| 277 | + print('Created QC state: ' + row['label']) |
| 278 | + |
| 279 | +result = select_rows(server_context, "core", "qcstate") |
| 280 | + |
| 281 | +# Update a QC state definitions |
| 282 | +originalValue = result['rows'][1] |
| 283 | +testRow = { |
| 284 | + 'RowId': originalValue['RowId'], |
| 285 | + 'label': 'Updated Label' |
| 286 | +} |
| 287 | +updateResult = update_rows(server_context, "core", "qcstate", [testRow]) |
| 288 | +print('Updated label: approved -> ' + updateResult['rows'][0]['label']) |
| 289 | + |
| 290 | +# Delete all unused QC state definitions |
| 291 | +result = select_rows(server_context, 'core', 'qcstate') |
| 292 | +for row in result['rows']: |
| 293 | + print('Deleting QC state: ' + row['Label']) |
| 294 | + try: |
| 295 | + delete_rows(server_context, 'core', 'qcstate', [row]) |
| 296 | + except ServerContextError as sce: |
| 297 | + print(sce) |
0 commit comments