Skip to content

Conversation

@jana-selva
Copy link
Contributor

No description provided.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this needs to go to tests/ui

Comment on lines 30 to 32
with open("./ai_lab_secure_configuration_storage.sqlite", "rb") as f:
data = f.read()
assert data
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can open the file with

https://github.com/exasol/notebook-connector/blob/main/exasol%2Fnb_connector%2Fsecret_store.py#L23

It should open with the password you used to create it.

Furthermore, you need to remove the file at the end of the test. Probably the best is to run the test in a temporary directory. Probably best with the fixture tmp_path and a context for chdir.

Co-authored-by: Torsten Kilias <[email protected]>

box_element = page_session.locator(":text('Configuration Store')").locator('..').locator('..')
box_element.wait_for()
box_element.screenshot()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tkilias
box_element.screenshot() - i had to add this line because, the open button is not getting the tick mark,

is this allowed ??

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least something we might need to investigate, because you're also calling box_element.screenshot() in line 25. A reason why the tick mark is missing could be that there is a slight delay until the tick mark appears. Could replace the box_element.screenshot() in line 23 with a sleep.

box_element.wait_for()
box_element.screenshot()

assert_solara_snapshot(box_element.screenshot()) No newline at end of file
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

open_btn.icon = 'check'
finally:
# Save the file in the shared store.
if ipython and hasattr(ipython, 'run_line_magic'):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jana-selva added this, because run_line_magic is throwing

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add a comment that we added this to enable testing.

sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
- name: Tests
run: poetry run -- pytest -rA --setup-show test/ui/
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need matrix for this ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how long does the test run?

assert_screenshot(assert_solara_snapshot, page_session)
generated_db_file = is_sb_file_exists("ai_lab_secure_configuration_storage.sqlite")
verify_content(dummy_password, generated_db_file)

Copy link
Contributor Author

@jana-selva jana-selva Nov 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added new tests for verifying valid and invalid password. please review the below code.

now working on tmp_path

Copy link
Contributor Author

@jana-selva jana-selva Nov 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added monkeypatch to change cwd to tmp_path

generated_db_file = is_sb_file_exists("ai_lab_secure_configuration_storage.sqlite")
verify_content(dummy_password, generated_db_file)

def test_valid_store_password(solara_test, page_session,assert_solara_snapshot,tmp_path,monkeypatch):
Copy link
Collaborator

@tkilias tkilias Nov 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def test_valid_store_password(solara_test, page_session,assert_solara_snapshot,tmp_path,monkeypatch):
def test_non_default_store_file(solara_test, page_session,assert_solara_snapshot,tmp_path,monkeypatch):

def test_valid_store_password(solara_test, page_session,assert_solara_snapshot,tmp_path,monkeypatch):
monkeypatch.chdir(tmp_path)
dummy_password = "dummy123"
dummy_sb_store_file = "ai_lab_secure_dummy.sqlite"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For what does "sb" stand in sb_store_file?

with pytest.raises(InvalidPassword) as exception:
dummy_password = "dummy123"
dummy_sb_store_file = "ai_lab_invalid_dummy.sqlite"
display(get_access_store_ui())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to create the secret store before you display the UI. We want to test how the UI reacts if you enter the wrong password and not how the secret store reacts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants