예제 #1
0
class TestPackageRepository(TestCase):
    def setUp(self):
        self.repo = PackageRepository(PACKAGE_DIR)

    def test_find(self):
        package = self.repo.find('foo==1.0')
        self._check_package(package[0], 'foo', '1.0', '1')

    def test_find_without_version(self):
        package = self.repo.find('foo')
        self._check_package(package[0], 'foo', '1.0', '1')

    def _check_package(self, package, name, version, revision):
        self.assertEqual(package.name, name)
        self.assertEqual(package.version, version)
        self.assertEqual(package.revision, revision)

    def test_iter(self):
        self.assertEqual([(p.name, p.version, p.revision) for p in self.repo],
                         [(u'foo', u'1.0', u'1'), (u'bar', u'1.0', u'1'),
                          (u'foo-bar', u'1.0', u'1')])
예제 #2
0
 def setUp(self):
     self.repo = PackageRepository(PACKAGE_DIR)