예제 #1
0
 def test_synchronize_sources_list_directory(self):
     filename = self.makeFile(SOURCES_LIST_1,
                              dirname=self.apt_dir,
                              basename="sources.list")
     self.makeFile(SOURCES_LIST_2, dirname=self.sources_dir, suffix=".list")
     syncAptChannels(filename, self.sources_dir)
     self.assertEquals(
         sysconf.get("channels"), {
             "aptsync-1cd42dbb12232a2e2582ad0145fd0516": {
                 "type": "apt-deb",
                 "name": "distro/name1 - comp1 comp2",
                 "distribution": "distro/name1",
                 "components": "comp1 comp2",
                 "baseurl": "http://some/url/"
             },
             "aptsync-ca9430daa6beaccf4d4c9aad9e365c26": {
                 "type": "apt-rpm",
                 "name": "distro/name2 - comp1 comp2",
                 "components": "comp1 comp2",
                 "baseurl": "http://some/url/distro/name2"
             },
             "aptsync-a3ea5e5aa96019e33241318e7f87a3d1": {
                 "type": "apt-deb",
                 "name": "distro/name3 - comp1 comp2",
                 "distribution": "distro/name3",
                 "components": "comp1 comp2",
                 "baseurl": "http://some/url/"
             },
         })
예제 #2
0
 def test_cleanup_removed_entries(self):
     filename = self.makeFile(
         SOURCES_LIST_1, dirname=self.apt_dir, basename="sources.list")
     self.makeFile(SOURCES_LIST_2, dirname=self.sources_dir, suffix=".list")
     syncAptChannels(filename, self.sources_dir)
     filename = self.makeFile(
         SOURCES_LIST_3, dirname=self.apt_dir, basename="sources.list")
     syncAptChannels(filename, self.sources_dir)
     self.assertEquals(
         sysconf.get("channels"), {
             "aptsync-1cd42dbb12232a2e2582ad0145fd0516": {
                 "type": "apt-deb",
                 "name": "distro/name1 - comp1 comp2",
                 "distribution": "distro/name1",
                 "components": "comp1 comp2",
                 "baseurl": "http://some/url/"
             },
             "aptsync-a3ea5e5aa96019e33241318e7f87a3d1": {
                 "type": "apt-deb",
                 "name": "distro/name3 - comp1 comp2",
                 "distribution": "distro/name3",
                 "components": "comp1 comp2",
                 "baseurl": "http://some/url/"
             },
         })
예제 #3
0
 def test_cleanup_removed_entries(self):
     filename = self.makeFile(SOURCES_LIST_1,
                              dirname=self.apt_dir,
                              basename="sources.list")
     self.makeFile(SOURCES_LIST_2, dirname=self.sources_dir, suffix=".list")
     syncAptChannels(filename, self.sources_dir)
     filename = self.makeFile(SOURCES_LIST_3,
                              dirname=self.apt_dir,
                              basename="sources.list")
     syncAptChannels(filename, self.sources_dir)
     self.assertEquals(
         sysconf.get("channels"), {
             "aptsync-1cd42dbb12232a2e2582ad0145fd0516": {
                 "type": "apt-deb",
                 "name": "distro/name1 - comp1 comp2",
                 "distribution": "distro/name1",
                 "components": "comp1 comp2",
                 "baseurl": "http://some/url/"
             },
             "aptsync-a3ea5e5aa96019e33241318e7f87a3d1": {
                 "type": "apt-deb",
                 "name": "distro/name3 - comp1 comp2",
                 "distribution": "distro/name3",
                 "components": "comp1 comp2",
                 "baseurl": "http://some/url/"
             },
         })
예제 #4
0
 def test_synchronize_sources_list_directory(self):
     filename = self.makeFile(
         SOURCES_LIST_1, dirname=self.apt_dir, basename="sources.list")
     self.makeFile(SOURCES_LIST_2, dirname=self.sources_dir, suffix=".list")
     syncAptChannels(filename, self.sources_dir)
     self.assertEquals(
         sysconf.get("channels"), {
             "aptsync-1cd42dbb12232a2e2582ad0145fd0516": {
                 "type": "apt-deb",
                 "name": "distro/name1 - comp1 comp2",
                 "distribution": "distro/name1",
                 "components": "comp1 comp2",
                 "baseurl": "http://some/url/"
             },
             "aptsync-ca9430daa6beaccf4d4c9aad9e365c26": {
                 "type": "apt-rpm",
                 "name": "distro/name2 - comp1 comp2",
                 "components": "comp1 comp2",
                 "baseurl": "http://some/url/distro/name2"
             },
             "aptsync-a3ea5e5aa96019e33241318e7f87a3d1": {
                 "type": "apt-deb",
                 "name": "distro/name3 - comp1 comp2",
                 "distribution": "distro/name3",
                 "components": "comp1 comp2",
                 "baseurl": "http://some/url/"
             },
         })
예제 #5
0
 def test_translate_ssh_entries(self):
     filename = self.makeFile(SOURCES_LIST_5, dirname=self.apt_dir,
                              basename="sources.list")
     syncAptChannels(filename, self.sources_dir)
     self.assertEquals(sysconf.get("channels"), {
                       "aptsync-1ce4291e0de00c14900dd35eae867c9b":
                           {"type": "apt-deb",
                            "name": "distro/name1 - comp1 comp2",
                            "distribution": "distro/name1",
                            "components": "comp1 comp2",
                            "baseurl": "scp://some/url/"},
                      })
예제 #6
0
 def test_trustdb_is_set_when_present(self):
     open(self.trustdb_file, "w").close()
     filename = self.makeFile(SOURCES_LIST_2, dirname=self.apt_dir,
                              basename="sources.list")
     syncAptChannels(filename, self.sources_dir)
     self.assertEquals(sysconf.get("channels"),
                       {"aptsync-a3ea5e5aa96019e33241318e7f87a3d1":
                           {"type": "apt-deb",
                            "name": "distro/name3 - comp1 comp2",
                            "distribution": "distro/name3",
                            "components": "comp1 comp2",
                            "baseurl": "http://some/url/",
                            "trustdb": self.trustdb_file}
                        })
예제 #7
0
 def test_preserves_unrelated_changes(self):
     filename = self.makeFile(SOURCES_LIST_1, dirname=self.apt_dir,
                              basename="sources.list")
     syncAptChannels(filename, self.sources_dir)
     channel_key = "aptsync-1cd42dbb12232a2e2582ad0145fd0516"
     sysconf.set(("channels", channel_key, "disabled"), True)
     syncAptChannels(filename, self.sources_dir)
     self.assertEquals(sysconf.get(("channels", channel_key)),
                       {"distribution": "distro/name1",
                        "type": "apt-deb",
                        "name": "distro/name1 - comp1 comp2",
                        "components": "comp1 comp2",
                        "baseurl": "http://some/url/",
                        "disabled": True})
예제 #8
0
 def test_trustdb_is_set_when_present(self):
     open(self.trustdb_file, "w").close()
     filename = self.makeFile(SOURCES_LIST_2, dirname=self.apt_dir,
                              basename="sources.list")
     syncAptChannels(filename, self.sources_dir)
     self.assertEquals(sysconf.get("channels"),
                       {"aptsync-a3ea5e5aa96019e33241318e7f87a3d1":
                           {"type": "apt-deb",
                            "name": "distro/name3 - comp1 comp2",
                            "distribution": "distro/name3",
                            "components": "comp1 comp2",
                            "baseurl": "http://some/url/",
                            "trustdb": self.trustdb_file}
                        })
예제 #9
0
 def test_preserves_unrelated_changes(self):
     filename = self.makeFile(SOURCES_LIST_1, dirname=self.apt_dir,
                              basename="sources.list")
     syncAptChannels(filename, self.sources_dir)
     channel_key = "aptsync-1cd42dbb12232a2e2582ad0145fd0516"
     sysconf.set(("channels", channel_key, "disabled"), True)
     syncAptChannels(filename, self.sources_dir)
     self.assertEquals(sysconf.get(("channels", channel_key)),
                       {"distribution": "distro/name1",
                        "type": "apt-deb",
                        "name": "distro/name1 - comp1 comp2",
                        "components": "comp1 comp2",
                        "baseurl": "http://some/url/",
                        "disabled": True})
 def test_keyring_is_set_when_present(self):
     shutil.copyfile(TESTDATA_KEYRING, self.keyring_file)
     filename = self.makeFile(SOURCES_LIST_2, dirname=self.apt_dir,
                              basename="sources.list")
     syncAptChannels(filename, self.sources_dir)
     self.assertEquals(sysconf.get("channels"),
                       {"aptsync-a3ea5e5aa96019e33241318e7f87a3d1":
                           {"type": "apt-deb",
                            "name": "distro/name3 - comp1 comp2",
                            "distribution": "distro/name3",
                            "components": "comp1 comp2",
                            "baseurl": "http://some/url/",
                            "keyring": self.keyring_file}
                        })
예제 #11
0
 def test_translate_ssh_entries(self):
     filename = self.makeFile(SOURCES_LIST_5,
                              dirname=self.apt_dir,
                              basename="sources.list")
     syncAptChannels(filename, self.sources_dir)
     self.assertEquals(
         sysconf.get("channels"), {
             "aptsync-1ce4291e0de00c14900dd35eae867c9b": {
                 "type": "apt-deb",
                 "name": "distro/name1 - comp1 comp2",
                 "distribution": "distro/name1",
                 "components": "comp1 comp2",
                 "baseurl": "scp://some/url/"
             },
         })
예제 #12
0
 def test_keyring_isnt_reset_after_being_removed(self):
     open(self.keyring_file, "w").close()
     filename = self.makeFile(SOURCES_LIST_2, dirname=self.apt_dir,
                              basename="sources.list")
     syncAptChannels(filename, self.sources_dir)
     sysconf.remove(("channels",
                     "aptsync-a3ea5e5aa96019e33241318e7f87a3d1",
                     "keyring"))
     syncAptChannels(filename, self.sources_dir)
     self.assertEquals(sysconf.get("channels"),
                       {"aptsync-a3ea5e5aa96019e33241318e7f87a3d1":
                           {"type": "apt-deb",
                            "name": "distro/name3 - comp1 comp2",
                            "distribution": "distro/name3",
                            "components": "comp1 comp2",
                            "baseurl": "http://some/url/"},
                       })
예제 #13
0
 def test_keyring_is_set_when_present(self):
     shutil.copyfile(TESTDATA_KEYRING, self.keyring_file)
     filename = self.makeFile(SOURCES_LIST_2,
                              dirname=self.apt_dir,
                              basename="sources.list")
     syncAptChannels(filename, self.sources_dir)
     self.assertEquals(
         sysconf.get("channels"), {
             "aptsync-a3ea5e5aa96019e33241318e7f87a3d1": {
                 "type": "apt-deb",
                 "name": "distro/name3 - comp1 comp2",
                 "distribution": "distro/name3",
                 "components": "comp1 comp2",
                 "baseurl": "http://some/url/",
                 "keyring": self.keyring_file
             }
         })
예제 #14
0
 def test_keyring_isnt_reset_after_being_removed(self):
     open(self.keyring_file, "w").close()
     filename = self.makeFile(SOURCES_LIST_2, dirname=self.apt_dir,
                              basename="sources.list")
     syncAptChannels(filename, self.sources_dir)
     sysconf.remove(("channels",
                     "aptsync-a3ea5e5aa96019e33241318e7f87a3d1",
                     "keyring"))
     syncAptChannels(filename, self.sources_dir)
     self.assertEquals(sysconf.get("channels"),
                       {"aptsync-a3ea5e5aa96019e33241318e7f87a3d1":
                           {"type": "apt-deb",
                            "name": "distro/name3 - comp1 comp2",
                            "distribution": "distro/name3",
                            "components": "comp1 comp2",
                            "baseurl": "http://some/url/"},
                       })
예제 #15
0
 def test_ignore_cdrom_entries(self):
     filename = self.makeFile(SOURCES_LIST_4,
                              dirname=self.apt_dir,
                              basename="sources.list")
     syncAptChannels(filename, self.sources_dir)
     self.assertEquals(sysconf.get("channels"), None)
예제 #16
0
 def test_ignore_cdrom_entries(self):
     filename = self.makeFile(SOURCES_LIST_4, dirname=self.apt_dir,
                              basename="sources.list")
     syncAptChannels(filename, self.sources_dir)
     self.assertEquals(sysconf.get("channels"), None)