Exemple #1
0
    def setUp(self):
        engine = create_engine(DB_PATH)
        DBSession.configure(bind=engine)
        Base.metadata.create_all(engine)
        self.db = DBSession()
        populate(self.db)

        # Initialize our temporary repo
        self.tempdir = tempfile.mkdtemp("bodhi")
        self.temprepo = join(self.tempdir, "f17-updates-testing")
        mkmetadatadir(join(self.temprepo, "f17-updates-testing", "i386"))
        self.repodata = join(self.temprepo, "f17-updates-testing", "i386", "repodata")
        assert exists(join(self.repodata, "repomd.xml"))

        DevBuildsys.__rpms__ = [
            {
                "arch": "src",
                "build_id": 6475,
                "buildroot_id": 1883,
                "buildtime": 1178868422,
                "epoch": None,
                "id": 62330,
                "name": "bodhi",
                "nvr": "bodhi-2.0-1.fc17",
                "release": "1.fc17",
                "size": 761742,
                "version": "2.0",
            }
        ]
Exemple #2
0
    def setUp(self):
        fd, self.db_filename = tempfile.mkstemp(prefix='bodhi-testing-',
                                                suffix='.db')
        db_path = 'sqlite:///%s' % self.db_filename
        # The BUILD_ID environment variable is set by Jenkins and allows us to
        # detect if
        # we are running the tests in jenkins or not
        # https://wiki.jenkins-ci.org/display/JENKINS/Building+a+software+project#Buildingasoftwareproject-below
        if os.environ.get('BUILD_ID'):
            faitout = 'http://209.132.184.152/faitout/'
            try:
                import requests
                req = requests.get('%s/new' % faitout)
                if req.status_code == 200:
                    db_path = req.text
                    print 'Using faitout at: %s' % db_path
            except:
                pass
        engine = create_engine(db_path)
        Base.metadata.create_all(engine)
        self.db_factory = transactional_session_maker(engine)

        with self.db_factory() as session:
            populate(session)
            assert session.query(Update).count() == 1

        self.koji = buildsys.get_session()
        self.koji.clear()  # clear out our dev introspection

        self.msg = makemsg()
        self.tempdir = tempfile.mkdtemp('bodhi')
        self.masher = Masher(FakeHub(),
                             db_factory=self.db_factory,
                             mash_dir=self.tempdir)
Exemple #3
0
    def setUp(self):
        engine = create_engine(DB_PATH)
        Session = scoped_session(
            sessionmaker(extension=ZopeTransactionExtension()))
        Session.configure(bind=engine)
        log.debug('Creating all models for %s' % engine)
        Base.metadata.bind = engine
        Base.metadata.create_all(engine)
        self.db = Session()
        populate(self.db)

        # Initialize our temporary repo
        self.tempdir = tempfile.mkdtemp('bodhi')
        self.temprepo = join(self.tempdir, 'f17-updates-testing')
        mkmetadatadir(join(self.temprepo, 'f17-updates-testing', 'i386'))
        self.repodata = join(self.temprepo, 'f17-updates-testing', 'i386',
                             'repodata')
        assert exists(join(self.repodata, 'repomd.xml'))

        DevBuildsys.__rpms__ = [{
            'arch': 'src',
            'build_id': 6475,
            'buildroot_id': 1883,
            'buildtime': 1178868422,
            'epoch': None,
            'id': 62330,
            'name': 'bodhi',
            'nvr': 'bodhi-2.0-1.fc17',
            'release': '1.fc17',
            'size': 761742,
            'version': '2.0'
        }]
Exemple #4
0
    def setUp(self):
        fd, self.db_filename = tempfile.mkstemp(prefix="bodhi-testing-", suffix=".db")
        db_path = "sqlite:///%s" % self.db_filename
        # The BUILD_ID environment variable is set by Jenkins and allows us to
        # detect if
        # we are running the tests in jenkins or not
        # https://wiki.jenkins-ci.org/display/JENKINS/Building+a+software+project#Buildingasoftwareproject-below
        if os.environ.get("BUILD_ID"):
            faitout = "http://209.132.184.152/faitout/"
            try:
                import requests

                req = requests.get("%s/new" % faitout)
                if req.status_code == 200:
                    db_path = req.text
                    print "Using faitout at: %s" % db_path
            except:
                pass
        engine = create_engine(db_path)
        Base.metadata.create_all(engine)
        self.db_factory = transactional_session_maker(engine)

        with self.db_factory() as session:
            populate(session)
            assert session.query(Update).count() == 1

        self.koji = buildsys.get_session()
        self.koji.clear()  # clear out our dev introspection

        self.msg = makemsg()
        self.tempdir = tempfile.mkdtemp("bodhi")
        self.masher = Masher(FakeHub(), db_factory=self.db_factory, mash_dir=self.tempdir)
Exemple #5
0
    def setUp(self):
        engine = create_engine(DB_PATH)
        Session = scoped_session(sessionmaker(extension=ZopeTransactionExtension()))
        Session.configure(bind=engine)
        log.debug('Creating all models for %s' % engine)
        Base.metadata.bind = engine
        Base.metadata.create_all(engine)
        self.db = Session()
        populate(self.db)

        # Initialize our temporary repo
        self.tempdir = tempfile.mkdtemp('bodhi')
        self.temprepo = join(self.tempdir, 'f17-updates-testing')
        mkmetadatadir(join(self.temprepo, 'f17-updates-testing', 'i386'))
        self.repodata = join(self.temprepo, 'f17-updates-testing', 'i386', 'repodata')
        assert exists(join(self.repodata, 'repomd.xml'))

        DevBuildsys.__rpms__ = [{
            'arch': 'src',
            'build_id': 6475,
            'buildroot_id': 1883,
            'buildtime': 1178868422,
            'epoch': None,
            'id': 62330,
            'name': 'bodhi',
            'nvr': 'bodhi-2.0-1.fc17',
            'release': '1.fc17',
            'size': 761742,
            'version': '2.0'
        }]
Exemple #6
0
    def setUp(self):
        engine = create_engine(DB_PATH)
        DBSession.configure(bind=engine)
        log.debug('Creating all models for %s' % engine)
        Base.metadata.create_all(engine)
        self.db = DBSession()
        populate(self.db)
        self.app = TestApp(main({}, testing=u'guest', **self.app_settings))

        # Track sql statements in every test
        self.sql_statements = []
        def track(conn, cursor, statement, param, ctx, many):
            self.sql_statements.append(statement)

        event.listen(engine, "before_cursor_execute", track)
Exemple #7
0
    def setUp(self):
        engine = create_engine(DB_PATH)
        Session = scoped_session(sessionmaker(extension=ZopeTransactionExtension()))
        Session.configure(bind=engine)
        log.debug('Creating all models for %s' % engine)
        Base.metadata.bind = engine
        Base.metadata.create_all(engine)
        self.db = Session()
        populate(self.db)
        self.app = TestApp(main({}, testing=u'guest', session=self.db, **self.app_settings))

        # Track sql statements in every test
        self.sql_statements = []
        def track(conn, cursor, statement, param, ctx, many):
            self.sql_statements.append(statement)

        event.listen(engine, "before_cursor_execute", track)