Skip to content

Commit

Permalink
integration tests for apt-get and apt-cache exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
Perfect5th committed Dec 15, 2023
1 parent 2137e59 commit cdb4a0d
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/integration/test_apt.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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)

0 comments on commit cdb4a0d

Please sign in to comment.