FreedomBox/plinth/modules/storage/tests/test_functional.py
Sunil Mohan Adapa 4b708214e4 storage: tests: functional: Fix tests always getting skipped
- The method to check if we are running inside a container is not being called.
Call it.

- Also fix the assumption that tests and freedombox service run on the same
machine. Be conservative and assume running in container if we can't determine
the accurate state.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>

Reviewed-by: Fioddor Superconcentrado <fioddor@gmail.com>
2021-10-10 18:22:11 +02:00

30 lines
857 B
Python

# SPDX-License-Identifier: AGPL-3.0-or-later
"""
Functional, browser based tests for storage app.
"""
import pytest
from plinth.tests import functional
pytestmark = [pytest.mark.system, pytest.mark.essential, pytest.mark.storage]
@pytest.fixture(scope='module', autouse=True)
def fixture_background(session_browser):
"""Login."""
functional.login(session_browser)
def test_list_disks(session_browser):
"""Test that root disk is shown on storage page."""
if functional.running_inside_container():
pytest.skip('Storage doesn\'t work inside a container')
else:
functional.nav_to_module(session_browser, 'storage')
assert _is_root_disk_shown(session_browser)
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)