diff --git a/tests/integration/test_apt.py b/tests/integration/test_apt.py index ecbd4962..8a3b3282 100644 --- a/tests/integration/test_apt.py +++ b/tests/integration/test_apt.py @@ -27,6 +27,14 @@ def test_install_package(): assert get_command_path("jq") == "/usr/bin/jq" +def test_install_package_error(): + try: + apt.update() + apt.add_package("ceci-n'est-pas-un-paquet") + except apt.PackageError as e: + assert "Unable to locate package" in str(e) + + def test_remove_package(): # First ensure the package is present cfssl = apt.DebianPackage.from_apt_cache("golang-cfssl") @@ -77,3 +85,10 @@ def test_list_file_generation_external_repository(): apt.add_package("mongodb-org") assert get_command_path("mongod") == "/usr/bin/mongod" + + +def test_from_apt_cache_error(): + try: + apt.DebianPackage.from_apt_cache("ceci-n'est-pas-un-paquet") + except apt.PackageError as e: + assert "No packages found" in str(e)