Skip to content

Commit

Permalink
TST: add quick test_coll_builder_edit to verify edit functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
tangkong committed Oct 3, 2024
1 parent 996dc40 commit 2bf3f35
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion superscore/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,7 @@ def sample_client(
filestore_backend: FilestoreBackend,
dummy_cl: ControlLayer
) -> Client:
"""Return a client with actula data, but no communication capabilities"""
"""Return a client with actual data, but no communication capabilities"""
client = Client(backend=filestore_backend)
client.cl = dummy_cl

Expand Down
28 changes: 28 additions & 0 deletions superscore/tests/test_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import pytest
from pytestqt.qtbot import QtBot
from qtpy import QtCore

from superscore.client import Client
from superscore.model import Collection, Parameter
Expand Down Expand Up @@ -86,3 +87,30 @@ def test_coll_builder_add(collection_builder_page: CollectionBuilderPage):
page.add_collection_button.clicked.emit()
assert added_collection is page.data.children[1]
assert page.sub_coll_table_view._model.rowCount() == 1


def test_coll_builder_edit(
collection_builder_page: CollectionBuilderPage,
qtbot: QtBot
):
page = collection_builder_page

page.pv_line_edit.setText("THIS:PV")
page.add_pvs_button.clicked.emit()

pv_model = page.sub_pv_table_view.model()
qtbot.waitUntil(lambda: pv_model.rowCount() == 1)
assert "THIS:PV" in page.data.children[0].pv_name

first_index = pv_model.createIndex(0, 0)
pv_model.setData(first_index, "NEW:VP", role=QtCore.Qt.EditRole)

assert "NEW:VP" in page.data.children[0].pv_name

page.add_collection_button.clicked.emit()

coll_model = page.sub_coll_table_view.model()
qtbot.waitUntil(lambda: coll_model.rowCount() == 1)

coll_model.setData(first_index, 'anothername', role=QtCore.Qt.EditRole)
qtbot.waitUntil(lambda: "anothername" in page.data.children[1].title)

0 comments on commit 2bf3f35

Please sign in to comment.