"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tests/unit/repo/test_deb.py" between
snapcraft-4.5.1.tar.gz and snapcraft-4.5.2.tar.gz

About: Snapcraft is a build and packaging tool that makes it easy to incorporate components from different sources and build technologies or solutions.

test_deb.py  (snapcraft-4.5.1):test_deb.py  (snapcraft-4.5.2)
skipping to change at line 487 skipping to change at line 487
def test_get_package_for_file_with_diversions(self): def test_get_package_for_file_with_diversions(self):
self.assertThat(repo.Ubuntu.get_package_for_file("/bin/sh"), Equals("das h")) self.assertThat(repo.Ubuntu.get_package_for_file("/bin/sh"), Equals("das h"))
def test_get_package_for_file_not_found(self): def test_get_package_for_file_not_found(self):
self.assertRaises( self.assertRaises(
repo.errors.FileProviderNotFound, repo.errors.FileProviderNotFound,
repo.Ubuntu.get_package_for_file, repo.Ubuntu.get_package_for_file,
"/bin/not-found", "/bin/not-found",
) )
class TestUbuntuInstallRepo(unit.TestCase):
@mock.patch("snapcraft.internal.repo._deb._sudo_write_file")
def test_install_sources(self, mock_write):
new_sources = repo.Ubuntu.install_sources(
architectures=["amd64", "arm64"],
components=["test-component"],
formats=["deb", "deb-src"],
name="test-name",
suites=["test-suite1", "test-suite2"],
url="http://test.url/ubuntu",
)
self.assertThat(
mock_write.mock_calls,
Equals(
[
call(
content=b"Types: deb deb-src\nURIs: http://test.url/ubun
tu\nSuites: test-suite1 test-suite2\nComponents: test-component\nArchitectures:
amd64 arm64\n",
dst_path=Path(
"/etc/apt/sources.list.d/snapcraft-test-name.sources
"
),
)
]
),
)
self.assertThat(new_sources, Equals(True))
@mock.patch("snapcraft.internal.repo._deb._sudo_write_file")
def test_install_sources_no_format(self, mock_write):
new_sources = repo.Ubuntu.install_sources(
architectures=["amd64", "arm64"],
components=["test-component"],
formats=None,
name="test-name",
suites=["test-suite1", "test-suite2"],
url="http://test.url/ubuntu",
)
self.assertThat(
mock_write.mock_calls,
Equals(
[
call(
content=b"Types: deb\nURIs: http://test.url/ubuntu\nSuit
es: test-suite1 test-suite2\nComponents: test-component\nArchitectures: amd64 ar
m64\n",
dst_path=Path(
"/etc/apt/sources.list.d/snapcraft-test-name.sources
"
),
)
]
),
)
self.assertThat(new_sources, Equals(True))
@mock.patch("subprocess.run")
@mock.patch(
"snapcraft.internal.repo._deb.Ubuntu.install_sources", return_value=True
)
@mock.patch(
"snapcraft.internal.os_release.OsRelease.version_codename", return_value
="testy"
)
def test_install_ppa(self, os_release, mock_install_sources, mock_run):
repo.Ubuntu.install_ppa(ppa="test/ppa")
self.assertThat(
mock_install_sources.mock_calls,
Equals(
[
call(
components=["main"],
formats=["deb"],
name="ppa-test_ppa",
suites=["testy"],
url="http://ppa.launchpad.net/test/ppa/ubuntu",
)
]
),
)
class TestGetPackagesInBase(testtools.TestCase): class TestGetPackagesInBase(testtools.TestCase):
def test_hardcoded_bases(self): def test_hardcoded_bases(self):
for base in ("core", "core16", "core18"): for base in ("core", "core16", "core18"):
self.expectThat( self.expectThat(
repo._deb.get_packages_in_base(base=base), repo._deb.get_packages_in_base(base=base),
Equals(repo._deb._DEFAULT_FILTERED_STAGE_PACKAGES), Equals(repo._deb._DEFAULT_FILTERED_STAGE_PACKAGES),
) )
@mock.patch.object(repo._deb, "_get_dpkg_list_path") @mock.patch.object(repo._deb, "_get_dpkg_list_path")
def test_package_list_from_dpkg_list(self, mock_dpkg_list_path): def test_package_list_from_dpkg_list(self, mock_dpkg_list_path):
 End of changes. 1 change blocks. 
87 lines changed or deleted 0 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)