示例#1
0
class LocalRepositoryTestCase(unittest.TestCase):
    def setUp(self):
        os.environ["EUPS_PATH"] = testEupsStack
        self.pkgroot = os.path.join(testEupsStack, "testserver", "s2")
        self.eups = Eups()
        self.repos = Repository(self.eups, self.pkgroot)

    def tearDown(self):
        pass

    def testInit(self):
        self.assertTrue(self.repos.distServer, DistribServer)

    def testIsWritable(self):
        self.assertTrue(self.repos.isWritable())

    def testGetManifest(self):
        man = self.repos.getManifest("doxygen", "1.5.8", "generic")
        self.assertTrue(man is not None)

    def testListPackages(self):
        pkgs = self.repos.listPackages()
        self.assertTrue(pkgs is not None)
        self.assertTrue(isinstance(pkgs, list))
        self.assertEqual(len(pkgs), 1)
        self.assertEqual(pkgs[0][0], "doxygen")
        self.assertEqual(pkgs[0][1], "1.5.8")
        self.assertEqual(pkgs[0][2], "generic")

        pkgs = self.repos.listPackages("doxygen")
        self.assertTrue(pkgs is not None)
        self.assertTrue(isinstance(pkgs, list))
        self.assertEqual(len(pkgs), 1)
        self.assertEqual(pkgs[0][0], "doxygen")
        self.assertEqual(pkgs[0][1], "1.5.8")
        self.assertEqual(pkgs[0][2], "generic")

        pkgs = self.repos.listPackages("doxygen", "1.5.10")
        self.assertTrue(pkgs is not None)
        self.assertTrue(isinstance(pkgs, list))
        self.assertEqual(len(pkgs), 0)

    def testGetSupportedTags(self):
        tags = self.repos.getSupportedTags()
        self.assertEqual(len(tags), 1)
        self.assertIn("current", tags)

    def testFindPackage(self):
        pkg = self.repos.findPackage("doxygen")
        self.assertTrue(pkg is not None)
        self.assertEqual(pkg[0], "doxygen")
        self.assertEqual(pkg[1], "1.5.8")
        self.assertEqual(pkg[2], "generic")

        pkg = self.repos.findPackage("doxygen", "1.5.8")
        self.assertTrue(pkg is not None)
        self.assertEqual(pkg[0], "doxygen")
        self.assertEqual(pkg[1], "1.5.8")
        self.assertEqual(pkg[2], "generic")

        pkg = self.repos.findPackage("doxygen", "1.5.0")
        self.assertTrue(pkg is None)

        pkg = self.repos.findPackage("doxygen", "1.5.8", "Linux")
        self.assertTrue(pkg[2] == 'generic')

        pkg = self.repos.findPackage("doxygen", "1.5.8", "generic")
        self.assertTrue(pkg is not None)
        self.assertEqual(pkg[0], "doxygen")
        self.assertEqual(pkg[1], "1.5.8")
        self.assertEqual(pkg[2], "generic")

        tag = Tag("latest")
        pkg = self.repos.findPackage("doxygen", tag)
        self.assertTrue(pkg is not None)
        self.assertEqual(pkg[0], "doxygen")
        self.assertEqual(pkg[1], "1.5.8")
        self.assertEqual(pkg[2], "generic")
示例#2
0
class LsstRepositoryTestCase(unittest.TestCase):

    def setUp(self):
        if not os.environ.has_key("EUPS_DIR"):
            os.environ["EUPS_DIR"] = os.path.dirname(testEupsStack)
        self.pkgroot = pkgroot
        self.eups = Eups()
        self.opts = { "serverconf": 
                      { "DISTRIB_SERVER_CLASS": "eups.distrib.server.ConfigurableDistribServer",
                        "DISTRIB_CLASS": "eups.distrib.Distrib.DefaultDistrib" }
                      }
        self.repos = Repository(self.eups, self.pkgroot, options=self.opts)

    def tearDown(self):
        pass

    def testInit(self):
        self.assert_(self.repos.distServer, DistribServer)

    def testIsWritable(self):
        self.assert_(not self.repos.isWritable())

    def testGetManifest(self):
        man = self.repos.getManifest("doxygen", "1.5.9", "generic")
        self.assert_(man is not None)

    def testListPackages(self):
        pkgs = self.repos.listPackages()
        self.assert_(pkgs is not None)
        self.assert_(isinstance(pkgs, list))
        self.assert_(len(pkgs) > 300)

    def testGetSupportedTags(self):
        tags = self.repos.getSupportedTags()
        self.assertEquals(len(tags), 3)
        self.assert_("current" in tags)
        self.assert_("active" in tags)
        self.assert_("alpha" in tags)

    def testFindPackage(self):
        pkg = self.repos.findPackage("doxygen")
        self.assert_(pkg is not None)
        self.assertEquals(pkg[0], "doxygen")
        self.assertEquals(pkg[1], "1.5.4")
        self.assertEquals(pkg[2], "generic")

        pkg = self.repos.findPackage("doxygen", "1.5.9")
        self.assert_(pkg is not None)
        self.assertEquals(pkg[0], "doxygen")
        self.assertEquals(pkg[1], "1.5.9")
        self.assertEquals(pkg[2], "generic")

        pkg = self.repos.findPackage("doxygen", "1.5.0")
        self.assert_(pkg is None)

        pkg = self.repos.findPackage("doxygen", "1.5.9", "Linux")
        self.assert_(pkg is None)

        pkg = self.repos.findPackage("doxygen", "1.5.9", "generic")
        self.assert_(pkg is not None)
        self.assertEquals(pkg[0], "doxygen")
        self.assertEquals(pkg[1], "1.5.9")
        self.assertEquals(pkg[2], "generic")

        tag = Tag("newest")
        pkg = self.repos.findPackage("doxygen", tag)
        self.assert_(pkg is not None)
        self.assertEquals(pkg[0], "doxygen")
        self.assertEquals(pkg[1], "1.5.9")
        self.assertEquals(pkg[2], "generic")
示例#3
0
class LsstRepositoryTestCase(unittest.TestCase):
    def setUp(self):
        if "EUPS_DIR" not in os.environ:
            os.environ["EUPS_DIR"] = os.path.dirname(testEupsStack)
        self.pkgroot = pkgroot
        self.eups = Eups()
        self.opts = {
            "serverconf": {
                "DISTRIB_SERVER_CLASS":
                "eups.distrib.server.ConfigurableDistribServer",
                "DISTRIB_CLASS": "eups.distrib.Distrib.DefaultDistrib"
            }
        }
        self.repos = Repository(self.eups, self.pkgroot, options=self.opts)

    def tearDown(self):
        pass

    def testInit(self):
        self.assert_(self.repos.distServer, DistribServer)

    def testIsWritable(self):
        self.assert_(not self.repos.isWritable())

    def testGetManifest(self):
        man = self.repos.getManifest("doxygen", "1.5.9", "generic")
        self.assert_(man is not None)

    def testListPackages(self):
        pkgs = self.repos.listPackages()
        self.assert_(pkgs is not None)
        self.assert_(isinstance(pkgs, list))
        self.assert_(len(pkgs) > 300)

    def testGetSupportedTags(self):
        tags = self.repos.getSupportedTags()
        self.assertEqual(len(tags), 3)
        self.assertIn("current", tags)
        self.assertIn("active", tags)
        self.assertIn("alpha", tags)

    def testFindPackage(self):
        pkg = self.repos.findPackage("doxygen")
        self.assert_(pkg is not None)
        self.assertEqual(pkg[0], "doxygen")
        self.assertEqual(pkg[1], "1.5.4")
        self.assertEqual(pkg[2], "generic")

        pkg = self.repos.findPackage("doxygen", "1.5.9")
        self.assert_(pkg is not None)
        self.assertEqual(pkg[0], "doxygen")
        self.assertEqual(pkg[1], "1.5.9")
        self.assertEqual(pkg[2], "generic")

        pkg = self.repos.findPackage("doxygen", "1.5.0")
        self.assert_(pkg is None)

        pkg = self.repos.findPackage("doxygen", "1.5.9", "Linux")
        self.assert_(pkg is None)

        pkg = self.repos.findPackage("doxygen", "1.5.9", "generic")
        self.assert_(pkg is not None)
        self.assertEqual(pkg[0], "doxygen")
        self.assertEqual(pkg[1], "1.5.9")
        self.assertEqual(pkg[2], "generic")

        tag = Tag("latest")
        pkg = self.repos.findPackage("doxygen", tag)
        self.assert_(pkg is not None)
        self.assertEqual(pkg[0], "doxygen")
        self.assertEqual(pkg[1], "1.5.9")
        self.assertEqual(pkg[2], "generic")
class LocalRepositoryTestCase(unittest.TestCase):

    def setUp(self):
        os.environ["EUPS_PATH"] = testEupsStack
        self.pkgroot = os.path.join(testEupsStack, "testserver", "s2")
        self.eups = Eups()
        self.repos = Repository(self.eups, self.pkgroot)

    def tearDown(self):
        pass

    def testInit(self):
        self.assertTrue(self.repos.distServer, DistribServer)

    def testIsWritable(self):
        self.assertTrue(self.repos.isWritable())

    def testGetManifest(self):
        man = self.repos.getManifest("doxygen", "1.5.8", "generic")
        self.assertTrue(man is not None)

    def testListPackages(self):
        pkgs = self.repos.listPackages()
        self.assertTrue(pkgs is not None)
        self.assertTrue(isinstance(pkgs, list))
        self.assertEqual(len(pkgs), 1)
        self.assertEqual(pkgs[0][0], "doxygen")
        self.assertEqual(pkgs[0][1], "1.5.8")
        self.assertEqual(pkgs[0][2], "generic")

        pkgs = self.repos.listPackages("doxygen")
        self.assertTrue(pkgs is not None)
        self.assertTrue(isinstance(pkgs, list))
        self.assertEqual(len(pkgs), 1)
        self.assertEqual(pkgs[0][0], "doxygen")
        self.assertEqual(pkgs[0][1], "1.5.8")
        self.assertEqual(pkgs[0][2], "generic")

        pkgs = self.repos.listPackages("doxygen", "1.5.10")
        self.assertTrue(pkgs is not None)
        self.assertTrue(isinstance(pkgs, list))
        self.assertEqual(len(pkgs), 0)

    def testGetSupportedTags(self):
        tags = self.repos.getSupportedTags()
        self.assertEqual(len(tags), 1)
        self.assertIn("current", tags)

    def testFindPackage(self):
        pkg = self.repos.findPackage("doxygen")
        self.assertTrue(pkg is not None)
        self.assertEqual(pkg[0], "doxygen")
        self.assertEqual(pkg[1], "1.5.8")
        self.assertEqual(pkg[2], "generic")

        pkg = self.repos.findPackage("doxygen", "1.5.8")
        self.assertTrue(pkg is not None)
        self.assertEqual(pkg[0], "doxygen")
        self.assertEqual(pkg[1], "1.5.8")
        self.assertEqual(pkg[2], "generic")

        pkg = self.repos.findPackage("doxygen", "1.5.0")
        self.assertTrue(pkg is None)

        pkg = self.repos.findPackage("doxygen", "1.5.8", "Linux")
        self.assertTrue(pkg[2] == 'generic')

        pkg = self.repos.findPackage("doxygen", "1.5.8", "generic")
        self.assertTrue(pkg is not None)
        self.assertEqual(pkg[0], "doxygen")
        self.assertEqual(pkg[1], "1.5.8")
        self.assertEqual(pkg[2], "generic")

        tag = Tag("latest")
        pkg = self.repos.findPackage("doxygen", tag)
        self.assertTrue(pkg is not None)
        self.assertEqual(pkg[0], "doxygen")
        self.assertEqual(pkg[1], "1.5.8")
        self.assertEqual(pkg[2], "generic")