summaryrefslogtreecommitdiffstats
path: root/testing/mozbase/mozdevice/tests/test_is_app_installed.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /testing/mozbase/mozdevice/tests/test_is_app_installed.py
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/mozbase/mozdevice/tests/test_is_app_installed.py')
-rw-r--r--testing/mozbase/mozdevice/tests/test_is_app_installed.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/testing/mozbase/mozdevice/tests/test_is_app_installed.py b/testing/mozbase/mozdevice/tests/test_is_app_installed.py
new file mode 100644
index 0000000000..a51836bc02
--- /dev/null
+++ b/testing/mozbase/mozdevice/tests/test_is_app_installed.py
@@ -0,0 +1,38 @@
+#!/usr/bin/env python
+
+import mozunit
+import pytest
+from mozdevice import ADBError
+
+
+def test_is_app_installed(mock_adb_object):
+ """Tests that is_app_installed returns True if app is installed."""
+ assert mock_adb_object.is_app_installed("org.mozilla.geckoview_example")
+
+
+def test_is_app_installed_not_installed(mock_adb_object):
+ """Tests that is_app_installed returns False if provided app_name
+ does not resolve."""
+ assert not mock_adb_object.is_app_installed("some_random_name")
+
+
+def test_is_app_installed_partial_name(mock_adb_object):
+ """Tests that is_app_installed returns False if provided app_name
+ is only a partial match."""
+ assert not mock_adb_object.is_app_installed("fennec")
+
+
+def test_is_app_installed_package_manager_error(mock_adb_object):
+ """Tests that is_app_installed is able to raise an exception."""
+ with pytest.raises(ADBError):
+ mock_adb_object.is_app_installed("error")
+
+
+def test_is_app_installed_no_installed_package_found(mock_adb_object):
+ """Tests that is_app_installed is able to handle scenario
+ where no installed packages are found."""
+ assert not mock_adb_object.is_app_installed("none")
+
+
+if __name__ == "__main__":
+ mozunit.main()