Exemple #1
0
    def test_list_packages_remote_repo_NO_cache(self):
        t = DummyHTTPServerThread(53535, self.tmpdir)
        try:
            t.start()
            time.sleep(1)

            rpm_metadata = RpmMetadata("test_repo_http",
                                       ["http://localhost:53535/"])
            rpm_metadata.cachedir = self.cachedir
            rpm_metadata.cacheperiod = -1

            pkgs = rpm_metadata.list_packages(["noarch"])
            self.verify_result(
                pkgs, "http://localhost:53535/{0}".format(
                    os.path.basename(self.rpm)))

            pkgs = rpm_metadata.list_packages(["noarch"])
            self.verify_result(
                pkgs, "http://localhost:53535/{0}".format(
                    os.path.basename(self.rpm)))

            pkgs = rpm_metadata.list_packages(["noarch"])
            self.verify_result(
                pkgs, "http://localhost:53535/{0}".format(
                    os.path.basename(self.rpm)))
        finally:
            t.stop_it()

        t.join(2)
        if t.isAlive():
            os.abort()

        handled_requests = t.rqueue.get()
        self.assertEqual(handled_requests, 6)
Exemple #2
0
    def test_list_packages_remote_repo_NO_cache(self):
        t = DummyHTTPServerThread(53535, self.tmpdir)
        try:
            t.start()
            time.sleep(1)

            rpm_metadata = RpmMetadata("test_repo_http",
                                       ["http://localhost:53535/"])
            rpm_metadata.cachedir = self.cachedir
            rpm_metadata.cacheperiod = -1

            pkgs = rpm_metadata.list_packages(["noarch"])
            self.verify_result(pkgs,
                               "http://localhost:53535/{0}".format(
                                                   os.path.basename(self.rpm)))

            pkgs = rpm_metadata.list_packages(["noarch"])
            self.verify_result(pkgs,
                               "http://localhost:53535/{0}".format(
                                                   os.path.basename(self.rpm)))

            pkgs = rpm_metadata.list_packages(["noarch"])
            self.verify_result(pkgs,
                               "http://localhost:53535/{0}".format(
                                                   os.path.basename(self.rpm)))
        finally:
            t.stop_it()

        t.join(2)
        if t.isAlive():
            os.abort()

        handled_requests = t.rqueue.get()
        self.assertEqual(handled_requests, 6)
Exemple #3
0
    def test_list_packages_remote_repo_NO_cache(self):
        with DummyHTTPServer(53535, self.tmpdir) as httpd:
            httpd.serve_forever()

            rpm_metadata = RpmMetadata("test_repo_http",
                                       ["http://localhost:53535/"])
            rpm_metadata.cachedir = self.cachedir
            rpm_metadata.cacheperiod = -1

            pkgs = rpm_metadata.list_packages(["noarch"])
            self.verify_result(
                pkgs, "http://localhost:53535/{0}".format(
                    os.path.basename(self.rpm)))

            pkgs = rpm_metadata.list_packages(["noarch"])
            self.verify_result(
                pkgs, "http://localhost:53535/{0}".format(
                    os.path.basename(self.rpm)))

            pkgs = rpm_metadata.list_packages(["noarch"])
            self.verify_result(
                pkgs, "http://localhost:53535/{0}".format(
                    os.path.basename(self.rpm)))

            httpd.shutdown()

            self.assertEqual(httpd.requests, 6)
Exemple #4
0
    def test_list_packages_file_repo(self):
        """
        Test whether list_packages lists our ad-hoc
        repository with file:// protocol in URL correctly.
        """

        rpm_metadata = RpmMetadata("test_repo_file", ["file://" + self.tmpdir])
        rpm_metadata.cachedir = self.cachedir

        pkgs = rpm_metadata.list_packages(["noarch"])
        self.verify_result(
            pkgs, "file://{0}".format(
                os.path.join(self.tmpdir, os.path.basename(self.rpm))))
Exemple #5
0
    def test_list_packages_file_repo(self):
        """
        Test whether list_packages lists our ad-hoc
        repository with file:// protocol in URL correctly.
        """

        rpm_metadata = RpmMetadata("test_repo_file", ["file://" + self.tmpdir])
        rpm_metadata.cachedir = self.cachedir

        pkgs = rpm_metadata.list_packages(["noarch"])
        self.verify_result(pkgs,
                           "file://{0}".format(os.path.join(self.tmpdir,
                                               os.path.basename(self.rpm))))