FreedomBox/plinth/modules/storage/tests/test_functional.py
Tiago Zaniquelli a02b0baad1
tests: functional: storage: skip test List disks
Skip the test Scenario: List disks when inside a container

Reviewed-by: Joseph Nuthalapati <njoseph@riseup.net>
2021-06-14 00:12:27 +05:30

30 lines
796 B
Python

# SPDX-License-Identifier: AGPL-3.0-or-later
"""
Functional, browser based tests for storage app.
"""
import pytest
from pytest_bdd import given, parsers, scenarios, then
from plinth.tests import functional
scenarios('storage.feature')
@then('the root disk should be shown')
def storage_root_disk_is_shown(session_browser):
assert _is_root_disk_shown(session_browser)
@given(parsers.parse("I'm on the {name:w} page"))
def go_to_module(session_browser, name):
if functional.running_inside_container:
pytest.skip('Storage doesn\'t work inside a container')
else:
functional.nav_to_module(session_browser, name)
def _is_root_disk_shown(browser):
table_cells = browser.find_by_tag('td')
return any(cell.text.split('\n')[0] == '/' for cell in table_cells)