def test_adds_multiple_sources_list_files(self): hwpack = HardwarePack(self.metadata) source1 = "http://example.org/ ubuntu main universe" source2 = "http://example.org/ linaro" hwpack.add_apt_sources({"ubuntu": source1, "linaro": source2}) tf = self.get_tarfile(hwpack) self.assertThat(tf, HardwarePackHasFile("sources.list.d/ubuntu.list", content="deb " + source1 + "\n")) self.assertThat(tf, HardwarePackHasFile("sources.list.d/linaro.list", content="deb " + source2 + "\n"))
def test_overwrites_sources_list_file(self): hwpack = HardwarePack(self.metadata) old_source = "http://example.org/ ubuntu" hwpack.add_apt_sources({"ubuntu": old_source}) new_source = "http://example.org/ ubuntu main universe" hwpack.add_apt_sources({"ubuntu": new_source}) tf = self.get_tarfile(hwpack) self.assertThat(tf, HardwarePackHasFile("sources.list.d/ubuntu.list", content="deb " + new_source + "\n"))
def test_adds_sources_list_file(self): hwpack = HardwarePack(self.metadata) source = 'http://example.org/ ubuntu' hwpack.add_apt_sources({'ubuntu': source}) tf = self.get_tarfile(hwpack) self.assertThat( tf, HardwarePackHasFile("sources.list.d/ubuntu.list", content="deb " + source + "\n"))
def test_overwrites_sources_list_file(self): hwpack = HardwarePack(self.metadata) old_source = 'http://example.org/ ubuntu' hwpack.add_apt_sources({'ubuntu': old_source}) new_source = 'http://example.org/ ubuntu main universe' hwpack.add_apt_sources({'ubuntu': new_source}) tf = self.get_tarfile(hwpack) self.assertThat( tf, HardwarePackHasFile("sources.list.d/ubuntu.list", content="deb " + new_source + "\n"))
def test_password_removed_from_urls(self): hwpack = HardwarePack(self.metadata) url = "https://*****:*****@hostname/url precise main" hwpack.add_apt_sources({"protected": url}) tf = self.get_tarfile(hwpack) try: self.assertThat(tf, HardwarePackHasFile("sources.list.d/protected.list", content="deb " + url + "\n")) except MismatchError: pass # Expect to not find the password protected URL else: self.assertTrue(False, "Found password protected URL in hwpack")
def test_adds_multiple_sources_list_files(self): hwpack = HardwarePack(self.metadata) source1 = 'http://example.org/ ubuntu main universe' source2 = 'http://example.org/ linaro' hwpack.add_apt_sources({'ubuntu': source1, 'linaro': source2}) tf = self.get_tarfile(hwpack) self.assertThat( tf, HardwarePackHasFile("sources.list.d/ubuntu.list", content="deb " + source1 + "\n")) self.assertThat( tf, HardwarePackHasFile("sources.list.d/linaro.list", content="deb " + source2 + "\n"))
def test_password_removed_from_urls(self): hwpack = HardwarePack(self.metadata) url = "https://*****:*****@hostname/url precise main" hwpack.add_apt_sources({"protected": url}) tf = self.get_tarfile(hwpack) try: self.assertThat( tf, HardwarePackHasFile("sources.list.d/protected.list", content="deb " + url + "\n")) except MismatchError: pass # Expect to not find the password protected URL else: self.assertTrue(False, "Found password protected URL in hwpack")
def test_adds_sources_list_file(self): hwpack = HardwarePack(self.metadata) source = "http://example.org/ ubuntu" hwpack.add_apt_sources({"ubuntu": source}) tf = self.get_tarfile(hwpack) self.assertThat(tf, HardwarePackHasFile("sources.list.d/ubuntu.list", content="deb " + source + "\n"))