def test_Packages_file_empty_with_no_deb_content(self): package1 = DummyFetchedPackage("foo", "1.1", no_content=True) package2 = DummyFetchedPackage("bar", "1.1", no_content=True) hwpack = HardwarePack(self.metadata) hwpack.add_packages([package1, package2]) tf = self.get_tarfile(hwpack) self.assertThat(tf, HardwarePackHasFile("pkgs/Packages", content=""))
def test_Packages_file_correct_content_with_some_deb_content(self): package1 = DummyFetchedPackage("foo", "1.1", no_content=True) package2 = DummyFetchedPackage("bar", "1.1") hwpack = HardwarePack(self.metadata) hwpack.add_packages([package1, package2]) tf = self.get_tarfile(hwpack) self.assertThat(tf, HardwarePackHasFile("pkgs/Packages", content=get_packages_file([package2])))
def test_manifest_contains_package_info(self): package1 = DummyFetchedPackage("foo", "1.1") package2 = DummyFetchedPackage("bar", "1.2") hwpack = HardwarePack(self.metadata) hwpack.add_packages([package1, package2]) tf = self.get_tarfile(hwpack) self.assertThat(tf, HardwarePackHasFile("manifest", content="foo=1.1\nbar=1.2\n"))
def test_add_packages_without_content_leaves_out_debs(self): package1 = DummyFetchedPackage("foo", "1.1", no_content=True) hwpack = HardwarePack(self.metadata) hwpack.add_packages([package1]) tf = self.get_tarfile(hwpack) self.assertThat( tf, Not(HardwarePackHasFile("pkgs/%s" % package1.filename)))
def test_adds_multiple_packages_at_once(self): package1 = DummyFetchedPackage("foo", "1.1") package2 = DummyFetchedPackage("bar", "1.1") hwpack = HardwarePack(self.metadata) hwpack.add_packages([package1, package2]) tf = self.get_tarfile(hwpack) self.assertThat(tf, HardwarePackHasFile("pkgs/%s" % package1.filename, content=package1.content.read())) self.assertThat(tf, HardwarePackHasFile("pkgs/%s" % package2.filename, content=package2.content.read()))
def test_manifest_contains_package_info(self): package1 = DummyFetchedPackage("foo", "1.1") package2 = DummyFetchedPackage("bar", "1.2") hwpack = HardwarePack(self.metadata) hwpack.add_packages([package1, package2]) tf = self.get_tarfile(hwpack) self.assertThat( tf, HardwarePackHasFile("manifest", content="foo=1.1\nbar=1.2\n"))
def test_adds_packages(self): package = DummyFetchedPackage("foo", "1.1") hwpack = HardwarePack(self.metadata) hwpack.add_packages([package]) tf = self.get_tarfile(hwpack) self.assertThat( tf, HardwarePackHasFile("pkgs/%s" % package.filename, content=package.content.read()))
def test_Packages_file_correct_contents_with_packages(self): package1 = DummyFetchedPackage("foo", "1.1") package2 = DummyFetchedPackage("bar", "1.1") hwpack = HardwarePack(self.metadata) hwpack.add_packages([package1, package2]) tf = self.get_tarfile(hwpack) self.assertThat( tf, HardwarePackHasFile("pkgs/Packages", content=get_packages_file([package1, package2])))
def test_adds_multiple_packages_at_once(self): package1 = DummyFetchedPackage("foo", "1.1") package2 = DummyFetchedPackage("bar", "1.1") hwpack = HardwarePack(self.metadata) hwpack.add_packages([package1, package2]) tf = self.get_tarfile(hwpack) self.assertThat( tf, HardwarePackHasFile("pkgs/%s" % package1.filename, content=package1.content.read())) self.assertThat( tf, HardwarePackHasFile("pkgs/%s" % package2.filename, content=package2.content.read()))
def test_add_packages_without_content_leaves_out_debs(self): package1 = DummyFetchedPackage("foo", "1.1", no_content=True) hwpack = HardwarePack(self.metadata) hwpack.add_packages([package1]) tf = self.get_tarfile(hwpack) self.assertThat(tf, Not(HardwarePackHasFile("pkgs/%s" % package1.filename)))
def test_adds_packages(self): package = DummyFetchedPackage("foo", "1.1") hwpack = HardwarePack(self.metadata) hwpack.add_packages([package]) tf = self.get_tarfile(hwpack) self.assertThat(tf, HardwarePackHasFile("pkgs/%s" % package.filename, content=package.content.read()))