MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / test_widget_add_and_get

Function test_widget_add_and_get

tests/integration/test_workspaces.py:281–298  ·  view source on GitHub ↗

Adding a widget ref appears in the workspace's widgets list.

(api_client, clean_state)

Source from the content-addressed store, hash-verified

279
280@pytest.mark.project
281def test_widget_add_and_get(api_client, clean_state):
282 """Adding a widget ref appears in the workspace's widgets list."""
283 # GroupWidget::DataGrid (0) renders DashboardWidget::DashboardDataGrid (1):
284 # the compatible pair. Accelerometer/Gyro/GPS are fixed-layout groups that
285 # reject user-added datasets, so dataset_count would silently spawn a stray
286 # default group instead of populating this one.
287 gid = _add_group_with_datasets(api_client, "G", widget_type=0, dataset_count=3)
288 wid = _add_workspace(api_client, "W")["id"]
289 time.sleep(0.15)
290
291 _widget_add(api_client, wid, widget_type=1, group_id=gid, relative_index=0)
292 time.sleep(0.15)
293
294 widgets = _get_workspace(api_client, wid)["widgets"]
295 assert len(widgets) == 1
296 assert widgets[0]["widgetType"] == 1
297 assert widgets[0]["groupId"] == gid
298 assert widgets[0]["relativeIndex"] == 0
299
300
301@pytest.mark.project

Callers

nothing calls this directly

Calls 4

_add_group_with_datasetsFunction · 0.85
_add_workspaceFunction · 0.85
_widget_addFunction · 0.85
_get_workspaceFunction · 0.85

Tested by

no test coverage detected