tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

addon_uninstall.py (1073B)


      1 import pytest
      2 from support.addons import get_ids_for_installed_addons
      3 from tests.support.asserts import assert_error, assert_success
      4 from tests.support.helpers import get_base64_for_extension_file
      5 
      6 from . import install_addon, uninstall_addon
      7 
      8 
      9 def test_uninstall_nonexistent_addon(session):
     10    response = uninstall_addon(session, "i-do-not-exist-as-an-id")
     11    assert_error(response, "unknown error")
     12 
     13 
     14 @pytest.mark.allow_system_access
     15 @pytest.mark.parametrize(
     16    "filename, temporary",
     17    [("firefox/signed.xpi", True), ("firefox/unsigned.xpi", False)],
     18 )
     19 def test_uninstall_addon(session, filename, temporary):
     20    response = install_addon(
     21        session, "addon", get_base64_for_extension_file(filename), temporary
     22    )
     23    addon_id = assert_success(response)
     24 
     25    installed_addon_ids = get_ids_for_installed_addons(session)
     26 
     27    assert addon_id in installed_addon_ids
     28 
     29    response = uninstall_addon(session, addon_id)
     30    assert_success(response)
     31 
     32    installed_addon_ids = get_ids_for_installed_addons(session)
     33 
     34    assert addon_id not in installed_addon_ids