Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/testing/mozbase/mozdevice/tests/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 2 kB image not shown  

Quelle  test_chown.py   Sprache: Python

 
#!/usr/bin/env python

import logging
from unittest.mock import patch

import mozunit
import pytest


@pytest.mark.parametrize("boolean_value", [TrueFalse])
def test_set_chown_r_attribute(
    mock_adb_object, redirect_stdout_and_assert, boolean_value
):
    mock_adb_object._chown_R = boolean_value
    assert mock_adb_object._chown_R == boolean_value


def test_chown_path_internal(mock_adb_object, redirect_stdout_and_assert):
    """Tests whether attempt to chown internal path is ignored"""
    with patch.object(logging, "getLogger"as mock_log:
        mock_adb_object._logger = mock_log

    testing_parameters = {
        "owner""someuser",
        "path""internal_storage",
    }
    expected = "Ignoring attempt to chown external storage"
    mock_adb_object.chown(**testing_parameters)
    assert "".join(mock_adb_object._logger.method_calls[0][1]) != ""
    assert "".join(mock_adb_object._logger.method_calls[0][1]) == expected


def test_chown_one_path(mock_adb_object, redirect_stdout_and_assert):
    """Tests the path where only one path is provided."""
    # set up mock logging and self._chown_R attribute.
    with patch.object(logging, "getLogger"as mock_log:
        mock_adb_object._logger = mock_log
    mock_adb_object._chown_R = True

    testing_parameters = {
        "owner""someuser",
        "path""/system",
    }
    command = "chown {owner} {path}".format(**testing_parameters)
    testing_parameters["text"] = command
    redirect_stdout_and_assert(mock_adb_object.chown, **testing_parameters)


def test_chown_one_path_with_group(mock_adb_object, redirect_stdout_and_assert):
    """Tests the path where group is provided."""
    # set up mock logging and self._chown_R attribute.
    with patch.object(logging, "getLogger"as mock_log:
        mock_adb_object._logger = mock_log
    mock_adb_object._chown_R = True

    testing_parameters = {
        "owner""someuser",
        "path""/system",
        "group""group_2",
    }
    command = "chown {owner}.{group} {path}".format(**testing_parameters)
    testing_parameters["text"] = command
    redirect_stdout_and_assert(mock_adb_object.chown, **testing_parameters)


if __name__ == "__main__":
    mozunit.main()

Messung V0.5
C=97 H=99 G=97

¤ Dauer der Verarbeitung: 0.3 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.