示例#1
0
    def test_search_packagers(self):
        """ Test the search_packagers function. """
        pkg = pkgdblib.search_packagers(self.session, 'pin*')
        self.assertEqual(pkg, [])

        create_package_listing(self.session)

        pkg = pkgdblib.search_packagers(self.session, 'pi*')
        self.assertEqual(len(pkg), 1)
        self.assertEqual(pkg[0][0], 'pingou')

        pkg = pkgdblib.search_packagers(self.session, 'pi*', page=0)
        self.assertEqual(len(pkg), 1)
        self.assertEqual(pkg[0][0], 'pingou')

        pkg = pkgdblib.search_packagers(self.session, 'pi*', limit=1, page=1)
        self.assertEqual(len(pkg), 1)
        self.assertEqual(pkg[0][0], 'pingou')

        self.assertRaises(pkgdblib.PkgdbException,
                          pkgdblib.search_packagers,
                          self.session,
                          'p*',
                          limit='a')

        self.assertRaises(pkgdblib.PkgdbException,
                          pkgdblib.search_packagers,
                          self.session,
                          'p*',
                          page='a')
示例#2
0
    def test_search_packagers(self):
        """ Test the search_packagers function. """
        pkg = pkgdblib.search_packagers(self.session, 'pin*')
        self.assertEqual(pkg, [])

        create_package_listing(self.session)

        pkg = pkgdblib.search_packagers(self.session, 'pi*')
        self.assertEqual(len(pkg), 1)
        self.assertEqual(pkg[0][0], 'pingou')

        pkg = pkgdblib.search_packagers(self.session, 'pi*', page=0)
        self.assertEqual(len(pkg), 1)
        self.assertEqual(pkg[0][0], 'pingou')

        pkg = pkgdblib.search_packagers(self.session, 'pi*', limit=1, page=1)
        self.assertEqual(len(pkg), 1)
        self.assertEqual(pkg[0][0], 'pingou')

        self.assertRaises(pkgdblib.PkgdbException,
                          pkgdblib.search_packagers,
                          self.session,
                          'p*',
                          limit='a'
                          )

        self.assertRaises(pkgdblib.PkgdbException,
                          pkgdblib.search_packagers,
                          self.session,
                          'p*',
                          page='a'
                          )
 def test_to_json(self):
     """ Test the to_json function of PackageListing. """
     create_package_listing(self.session)
     pkg = model.Package.by_name(self.session, 'guake')
     package = model.PackageListing.by_package_id(self.session, pkg.id)[0]
     package = package.to_json()
     self.assertEqual(package.keys(),
                      ['point_of_contact', 'collection', 'package'])
 def test_repr_package_listing(self):
     """ Test the __repr__ function of PackageListing. """
     create_package_listing(self.session)
     pkg = model.Package.by_name(self.session, 'guake')
     packages = model.PackageListing.by_package_id(self.session,
                                                     pkg.id)
     self.assertEqual("PackageListing(id:1, u'pingou', "
                      "u'Approved', packageid=1, collectionid=2)",
                      packages[0].__repr__())
 def test_init_package_listing(self):
     """ Test the __init__ function of PackageListing. """
     create_package_listing(self.session)
     pkg = model.Package.by_name(self.session, 'guake')
     self.assertEqual(2,
                      len(model.PackageListing.by_package_id(
                         self.session,
                         pkg.id))
                      )
 def test_to_json(self):
     """ Test the to_json function of PackageListing. """
     create_package_listing(self.session)
     pkg = model.Package.by_name(self.session, 'guake')
     package = model.PackageListing.by_package_id(self.session,
                                                  pkg.id)[0]
     package = package.to_json()
     self.assertEqual(package.keys(), ['point_of_contact',
                      'collection', 'package'])
示例#7
0
 def test_repr_package_listing(self):
     """ Test the __repr__ function of PackageListing. """
     create_package_listing(self.session)
     pkg = model.Package.by_name(self.session, 'guake')
     packages = model.PackageListing.by_package_id(self.session, pkg.id)
     self.assertEqual(
         "PackageListing(id:1, u'pingou', "
         "u'Approved', packageid=1, collectionid=2)",
         packages[0].__repr__())
示例#8
0
 def test_init_package_listing(self):
     """ Test the __init__ function of PackageListing. """
     create_package_listing(self.session)
     pkg = model.Package.by_name(self.session, 'guake')
     self.assertEqual(
         2,
         len(model.PackageListing.by_package_id(
             self.session, pkg.id))
     )
 def test_to_json(self):
     """ Test the to_json function of PackageListing. """
     create_package_listing(self.session)
     pkg = model.Package.by_name(self.session, 'rpms', 'guake')
     package = model.PackageListing.by_package_id(self.session,
                                                  pkg.id)[0]
     package = package.to_json()
     self.assertEqual(
         set(package.keys()),
         set(['status', 'package', 'status_change', 'collection',
              'point_of_contact', 'critpath']))
示例#10
0
 def test_to_json(self):
     """ Test the to_json function of PackageListing. """
     create_package_listing(self.session)
     pkg = model.Package.by_name(self.session, 'rpms', 'guake')
     package = model.PackageListing.by_package_id(self.session, pkg.id)[0]
     package = package.to_json()
     self.assertEqual(
         set(package.keys()),
         set([
             'status', 'package', 'status_change', 'collection',
             'point_of_contact', 'critpath'
         ]))
    def test_search_listing(self):
        """ Test the search function of PackageListing. """
        create_package_listing(self.session)
        collection = model.Collection.by_name(self.session, 'F-18')
        packages = model.PackageListing.search(self.session,
                                               pkg_name='g%',
                                               clt_id=collection.id,
                                               pkg_owner=None,
                                               pkg_status=None)
        self.assertEqual(2, len(packages))
        self.assertEqual("PackageListing(id:1, u'pingou', "
                         "u'Approved', packageid=1, collectionid=2)",
                         packages[0].__repr__())

        packages = model.PackageListing.search(self.session,
                                               pkg_name='g%',
                                               clt_id=collection.id,
                                               pkg_owner='pingou',
                                               pkg_status=None)
        self.assertEqual(2, len(packages))
        self.assertEqual("PackageListing(id:1, u'pingou', "
                         "u'Approved', packageid=1, collectionid=2)",
                         packages[0].__repr__())
        self.assertEqual("PackageListing(id:6, u'pingou', "
                         "u'Approved', packageid=3, collectionid=2)",
                         packages[1].__repr__())

        packages = model.PackageListing.search(self.session,
                                               pkg_name='g%',
                                               clt_id=collection.id,
                                               pkg_owner='pingou',
                                               pkg_status='Approved')
        self.assertEqual(2, len(packages))
        self.assertEqual("PackageListing(id:1, u'pingou', "
                         "u'Approved', packageid=1, collectionid=2)",
                         packages[0].__repr__())
        self.assertEqual("PackageListing(id:6, u'pingou', "
                         "u'Approved', packageid=3, collectionid=2)",
                         packages[1].__repr__())

        packages = model.PackageListing.search(self.session,
                                               pkg_name='g%',
                                               clt_id=collection.id,
                                               pkg_owner='pingou',
                                               pkg_status='Approved',
                                               count=True)
        self.assertEqual(2, packages)

        packages = model.PackageListing.search(self.session,
                                               pkg_name='g%',
                                               clt_id=collection.id,
                                               pkg_owner='pingou',
                                               pkg_status='Approved',
                                               limit=1)
        self.assertEqual("PackageListing(id:1, u'pingou', "
                         "u'Approved', packageid=1, collectionid=2)",
                         packages[0].__repr__())

        packages = model.PackageListing.search(self.session,
                                               pkg_name='g%',
                                               clt_id=collection.id,
                                               pkg_owner='pingou',
                                               pkg_status='Approved',
                                               critpath=False,
                                               offset=1)
        self.assertEqual(len(packages), 1)
        self.assertEqual("PackageListing(id:6, u'pingou', "
                         "u'Approved', packageid=3, collectionid=2)",
                         packages[0].__repr__())

        packages = model.PackageListing.search(self.session,
                                               pkg_name='g%',
                                               clt_id=collection.id,
                                               pkg_owner='pingou',
                                               pkg_status='Approved',
                                               critpath=True,
                                               offset=1)
        self.assertEqual(len(packages), 0)
示例#12
0
    def test_search_listing(self):
        """ Test the search function of PackageListing. """
        create_package_listing(self.session)
        collection = model.Collection.by_name(self.session, 'f18')
        packages = model.PackageListing.search(self.session,
                                               pkg_name='g%',
                                               clt_id=collection.id,
                                               pkg_owner=None,
                                               pkg_status=None)
        self.assertEqual(2, len(packages))
        self.assertEqual(
            "PackageListing(id:1, u'pingou', "
            "u'Approved', packageid=1, collectionid=2)",
            packages[0].__repr__())

        packages = model.PackageListing.search(self.session,
                                               pkg_name='g%',
                                               clt_id=collection.id,
                                               pkg_owner='pingou',
                                               pkg_status=None)
        self.assertEqual(2, len(packages))
        self.assertEqual(
            "PackageListing(id:1, u'pingou', "
            "u'Approved', packageid=1, collectionid=2)",
            packages[0].__repr__())
        self.assertEqual(
            "PackageListing(id:6, u'pingou', "
            "u'Approved', packageid=3, collectionid=2)",
            packages[1].__repr__())

        packages = model.PackageListing.search(self.session,
                                               pkg_name='g%',
                                               clt_id=collection.id,
                                               pkg_owner='pingou',
                                               pkg_status='Approved')
        self.assertEqual(2, len(packages))
        self.assertEqual(
            "PackageListing(id:1, u'pingou', "
            "u'Approved', packageid=1, collectionid=2)",
            packages[0].__repr__())
        self.assertEqual(
            "PackageListing(id:6, u'pingou', "
            "u'Approved', packageid=3, collectionid=2)",
            packages[1].__repr__())

        packages = model.PackageListing.search(self.session,
                                               pkg_name='g%',
                                               clt_id=collection.id,
                                               pkg_owner='pingou',
                                               pkg_status='Approved',
                                               count=True)
        self.assertEqual(2, packages)

        packages = model.PackageListing.search(self.session,
                                               pkg_name='g%',
                                               clt_id=collection.id,
                                               pkg_owner='pingou',
                                               pkg_status='Approved',
                                               limit=1)
        self.assertEqual(
            "PackageListing(id:1, u'pingou', "
            "u'Approved', packageid=1, collectionid=2)",
            packages[0].__repr__())

        packages = model.PackageListing.search(self.session,
                                               pkg_name='g%',
                                               clt_id=collection.id,
                                               pkg_owner='pingou',
                                               pkg_status='Approved',
                                               critpath=False,
                                               offset=1)
        self.assertEqual(len(packages), 1)
        self.assertEqual(
            "PackageListing(id:6, u'pingou', "
            "u'Approved', packageid=3, collectionid=2)",
            packages[0].__repr__())

        packages = model.PackageListing.search(self.session,
                                               pkg_name='g%',
                                               clt_id=collection.id,
                                               pkg_owner='pingou',
                                               pkg_status='Approved',
                                               critpath=True,
                                               offset=1)
        self.assertEqual(len(packages), 0)