Exemplo n.º 1
0
    def test_create_override_for_newer_build(self, publish):
        session = DBSession()
        old_build = Build.get(u'bodhi-2.0-1.fc17', session)

        build = Build(nvr=u'bodhi-2.0-2.fc17', package=old_build.package,
                      release=old_build.release)
        session.add(build)
        session.flush()

        expiration_date = datetime.utcnow() + timedelta(days=1)

        data = {'nvr': build.nvr, 'notes': u'blah blah blah',
                'expiration_date': expiration_date,
                'csrf_token': self.get_csrf_token()}
        res = self.app.post('/overrides/', data)

        publish.assert_any_call(topic='buildroot_override.tag', msg=mock.ANY)
        publish.assert_any_call(
            topic='buildroot_override.untag', msg=mock.ANY)

        o = res.json_body
        self.assertEquals(o['build_id'], build.id)
        self.assertEquals(o['notes'], 'blah blah blah')
        self.assertEquals(o['expiration_date'],
                          expiration_date.strftime("%Y-%m-%d %H:%M:%S"))
        self.assertEquals(o['expired_date'], None)

        old_build = Build.get(u'bodhi-2.0-1.fc17', session)

        self.assertNotEquals(old_build.override['expired_date'], None)
Exemplo n.º 2
0
 def test_filter_by_like(self):
     """ Test that filtering by like returns one package and not the other.
     """
     DBSession.add(Package(name='a_second_package'))
     resp = self.app.get('/packages/', dict(like='odh'))
     body = resp.json_body
     self.assertEquals(len(body['packages']), 1)
Exemplo n.º 3
0
    def test_cannot_edit_override_build(self, publish):
        session = DBSession()

        release = Release.get(u'F17', session)

        old_nvr = u'bodhi-2.0-1.fc17'

        res = self.app.get('/overrides/%s' % old_nvr)
        o = res.json_body['override']
        expiration_date = o['expiration_date']
        old_build_id = o['build_id']

        build = Build(nvr=u'bodhi-2.0-2.fc17', release=release)
        session.add(build)
        session.flush()

        o.update({
            'nvr': build.nvr,
            'edited': old_nvr,
            'csrf_token': self.get_csrf_token(),
        })
        res = self.app.post('/overrides/', o)

        override = res.json_body
        self.assertEquals(override['build_id'], old_build_id)
        self.assertEquals(override['notes'], 'blah blah blah')
        self.assertEquals(override['expiration_date'], expiration_date)
        self.assertEquals(override['expired_date'], None)
        self.assertEquals(len(publish.call_args_list), 0)
Exemplo n.º 4
0
    def test_unexpire_override(self, publish):
        session = DBSession()

        # First expire a buildroot override
        old_nvr = u'bodhi-2.0-1.fc17'
        override = Build.get(old_nvr, session).override
        override.expire()
        session.add(override)
        session.flush()

        publish.assert_called_once_with(
            topic='buildroot_override.untag', msg=mock.ANY)
        publish.reset_mock()

        # And now push its expiration_date into the future
        res = self.app.get('/overrides/%s' % old_nvr)
        o = res.json_body['override']

        expiration_date = datetime.now() + timedelta(days=1)
        expiration_date = expiration_date.strftime("%Y-%m-%d %H:%M:%S")

        o.update({'nvr': o['build']['nvr'],
                  'edited': old_nvr, 'expiration_date': expiration_date,
                  'csrf_token': self.get_csrf_token()})
        res = self.app.post('/overrides/', o)

        override = res.json_body
        self.assertEquals(override['build'], o['build'])
        self.assertEquals(override['notes'], o['notes'])
        self.assertEquals(override['expiration_date'], o['expiration_date'])
        self.assertEquals(override['expired_date'], None)
        publish.assert_called_once_with(
            topic='buildroot_override.tag', msg=mock.ANY)
Exemplo n.º 5
0
    def test_create_override(self, publish):
        session = DBSession()

        release = Release.get(u'F17', session)

        package = Package(name=u'not-bodhi')
        session.add(package)
        build = Build(nvr=u'not-bodhi-2.0-2.fc17', package=package,
                      release=release)
        session.add(build)
        session.flush()

        expiration_date = datetime.utcnow() + timedelta(days=1)

        data = {'nvr': build.nvr, 'notes': u'blah blah blah',
                'expiration_date': expiration_date,
                'csrf_token': self.get_csrf_token()}
        res = self.app.post('/overrides/', data)

        publish.assert_called_once_with(
            topic='buildroot_override.tag', msg=mock.ANY)
        self.assertEquals(len(publish.call_args_list), 1)

        o = res.json_body
        self.assertEquals(o['build_id'], build.id)
        self.assertEquals(o['notes'], 'blah blah blah')
        self.assertEquals(o['expiration_date'],
                          expiration_date.strftime("%Y-%m-%d %H:%M:%S"))
        self.assertEquals(o['expired_date'], None)
Exemplo n.º 6
0
    def setUp(self):
        super(TestUsersService, self).setUp()

        session = DBSession()
        user = User(name=u'bodhi')
        session.add(user)
        session.flush()
Exemplo n.º 7
0
 def test_list_comments_by_update_owner_with_none(self):
     session = DBSession()
     user = User(name=u'ralph')
     session.add(user)
     session.flush()
     res = self.app.get('/comments/', {"update_owner": "ralph"})
     body = res.json_body
     self.assertEquals(len(body['comments']), 0)
     self.assertNotIn('errors', body)
Exemplo n.º 8
0
    def test_list_overrides_by_username_without_override(self):
        session = DBSession()
        session.add(User(name=u'bochecha'))
        session.flush()

        res = self.app.get('/overrides/', {'user': '******'})

        body = res.json_body
        self.assertEquals(len(body['overrides']), 0)
Exemplo n.º 9
0
    def test_list_overrides_by_packages_without_override(self):
        session = DBSession()
        session.add(Package(name=u'python'))
        session.flush()

        res = self.app.get('/overrides/', {'packages': 'python'})

        body = res.json_body
        self.assertEquals(len(body['overrides']), 0)
Exemplo n.º 10
0
 def setup(self):
     engine = create_engine('sqlite://')
     DBSession.configure(bind=engine)
     Base.metadata.create_all(engine)
     try:
         new_attrs = {}
         new_attrs.update(self.attrs)
         new_attrs.update(self.do_get_dependencies())
         self.obj = self.klass(**new_attrs)
         DBSession.add(self.obj)
         DBSession.flush()
         return self.obj
     except:
         DBSession.rollback()
         raise
Exemplo n.º 11
0
    def setUp(self):
        super(TestReleasesService, self).setUp()

        session = DBSession()
        release = Release(
            name=u'F22', long_name=u'Fedora 22',
            id_prefix=u'FEDORA', version=u'22',
            dist_tag=u'f22', stable_tag=u'f22-updates',
            testing_tag=u'f22-updates-testing',
            candidate_tag=u'f22-updates-candidate',
            pending_testing_tag=u'f22-updates-testing-pending',
            pending_stable_tag=u'f22-updates-pending',
            override_tag=u'f22-override',
            branch=u'f22')

        session.add(release)
        session.flush()
Exemplo n.º 12
0
    def test_list_overrides_by_releases_without_override(self):
        session = DBSession()
        session.add(Release(name=u'F42', long_name=u'Fedora 42',
                            id_prefix=u'FEDORA', version=u'42',
                            dist_tag=u'f42', stable_tag=u'f42-updates',
                            testing_tag=u'f42-updates-testing',
                            candidate_tag=u'f42-updates-candidate',
                            pending_testing_tag=u'f42-updates-testing-pending',
                            pending_stable_tag=u'f42-updates-pending',
                            override_tag=u'f42-override',
                            branch=u'f42'))
        session.flush()

        res = self.app.get('/overrides/', {'releases': 'F42'})

        body = res.json_body
        self.assertEquals(len(body['overrides']), 0)
Exemplo n.º 13
0
    def test_create_override_too_long(self, publish):
        session = DBSession()

        release = Release.get(u'F17', session)

        package = Package(name=u'not-bodhi')
        session.add(package)
        build = Build(nvr=u'not-bodhi-2.0-2.fc17', package=package,
                      release=release)
        session.add(build)
        session.flush()

        expiration_date = datetime.utcnow() + timedelta(days=60)

        data = {'nvr': build.nvr, 'notes': u'blah blah blah',
                'expiration_date': expiration_date,
                'csrf_token': self.get_csrf_token()}
        self.app.post('/overrides/', data, status=400)
Exemplo n.º 14
0
    def test_list_builds_pagination(self):

        # First, stuff a second build in there
        session = DBSession()
        build = Build(nvr=u'bodhi-3.0-1.fc21')
        session.add(build)
        session.flush()

        # Then, test pagination
        res = self.app.get('/builds/', {"rows_per_page": 1})
        body = res.json_body
        self.assertEquals(len(body['builds']), 1)
        build1 = body['builds'][0]

        res = self.app.get('/builds/', {"rows_per_page": 1, "page": 2})
        body = res.json_body
        self.assertEquals(len(body['builds']), 1)
        build2 = body['builds'][0]

        self.assertNotEquals(build1, build2)
Exemplo n.º 15
0
    def test_list_comments_by_update_no_comments(self):
        session = DBSession()
        update = Update(
            title=u'bodhi-2.0-200.fc17',
            #builds=[build],
            #user=user,
            request=UpdateRequest.testing,
            type=UpdateType.enhancement,
            notes=u'Useful details!',
            #release=release,
            date_submitted=datetime(1984, 11, 02),
            requirements=u'rpmlint',
            stable_karma=3,
            unstable_karma=-3,
        )
        session.add(update)
        session.flush()

        res = self.app.get('/comments/', {"updates": "bodhi-2.0-200.fc17"})
        body = res.json_body
        self.assertEquals(len(body['comments']), 0)
Exemplo n.º 16
0
    def test_edit_unexisting_override(self):
        session = DBSession()
        release = Release.get(u'F17', session)

        build = Build(nvr=u'bodhi-2.0-2.fc17', release=release)
        session.add(build)
        session.flush()

        expiration_date = datetime.utcnow() + timedelta(days=1)

        o = {
            'nvr': build.nvr,
            'notes': 'blah blah blah',
            'expiration_date': expiration_date,
            'edited': build.nvr,
            'csrf_token': self.get_csrf_token(),
        }
        res = self.app.post('/overrides/', o, status=400)

        errors = res.json_body['errors']
        self.assertEquals(len(errors), 1)
        self.assertEquals(errors[0]['name'], 'edited')
        self.assertEquals(errors[0]['description'],
                          'No buildroot override for this build')
Exemplo n.º 17
0
    def test_create_override_multiple_nvr(self, publish):
        session = DBSession()

        release = Release.get(u'F17', session)
        package = Package(name=u'not-bodhi')
        session.add(package)
        build1 = Build(nvr=u'not-bodhi-2.0-2.fc17', package=package,
                      release=release)
        session.add(build1)
        session.flush()

        package = Package(name=u'another-not-bodhi')
        session.add(package)
        build2 = Build(nvr=u'another-not-bodhi-2.0-2.fc17', package=package,
                      release=release)
        session.add(build2)
        session.flush()

        expiration_date = datetime.utcnow() + timedelta(days=1)

        data = {
            'nvr': ','.join([build1.nvr, build2.nvr]),
            'notes': u'blah blah blah',
            'expiration_date': expiration_date,
            'csrf_token': self.get_csrf_token(),
        }
        res = self.app.post('/overrides/', data)

        self.assertEquals(len(publish.call_args_list), 2)

        result = res.json_body
        self.assertEquals(result['caveats'][0]['description'],
                          'Your override submission was split into 2.')

        o1, o2 = result['overrides']
        self.assertEquals(o1['build_id'], build1.id)
        self.assertEquals(o1['notes'], 'blah blah blah')
        self.assertEquals(o1['expiration_date'],
                          expiration_date.strftime("%Y-%m-%d %H:%M:%S"))
        self.assertEquals(o1['expired_date'], None)
        self.assertEquals(o2['build_id'], build2.id)
        self.assertEquals(o2['notes'], 'blah blah blah')
        self.assertEquals(o2['expiration_date'],
                          expiration_date.strftime("%Y-%m-%d %H:%M:%S"))
        self.assertEquals(o2['expired_date'], None)
Exemplo n.º 18
0
 def test_basic_json(self):
     """ Test querying with no arguments... """
     DBSession.add(Package(name='a_second_package'))
     resp = self.app.get('/packages/')
     body = resp.json_body
     self.assertEquals(len(body['packages']), 2)
Exemplo n.º 19
0
class TestExtendedMetadata(unittest.TestCase):
    def __init__(self, *args, **kw):
        super(TestExtendedMetadata, self).__init__(*args, **kw)
        repo_path = os.path.join(config.get("mash_dir"), "f17-updates-testing")
        if not os.path.exists(repo_path):
            os.makedirs(repo_path)

    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",
            }
        ]

    def tearDown(self):
        DBSession.remove()
        get_session().clear()
        shutil.rmtree(self.tempdir)

    def _verify_updateinfo(self, repodata):
        updateinfos = glob.glob(join(repodata, "*-updateinfo.xml*"))
        assert len(updateinfos) == 1, "We generated %d updateinfo metadata" % len(updateinfos)
        updateinfo = updateinfos[0]
        hash = basename(updateinfo).split("-", 1)[0]
        hashed = sha256(open(updateinfo).read()).hexdigest()
        assert hash == hashed, "File: %s\nHash: %s" % (basename(updateinfo), hashed)
        return updateinfo

    def get_notice(self, uinfo, title):
        for record in uinfo.updates:
            if record.title == title:
                return record

    def test_extended_metadata(self):
        update = self.db.query(Update).one()

        # Pretend it's pushed to testing
        update.status = UpdateStatus.testing
        update.request = None
        update.date_pushed = datetime.utcnow()
        DevBuildsys.__tagged__[update.title] = ["f17-updates-testing"]

        # Generate the XML
        md = ExtendedMetadata(update.release, update.request, self.db, self.temprepo)

        # Insert the updateinfo.xml into the repository
        md.insert_updateinfo()
        updateinfo = self._verify_updateinfo(self.repodata)

        # Read an verify the updateinfo.xml.gz
        uinfo = createrepo_c.UpdateInfo(updateinfo)
        notice = self.get_notice(uinfo, "mutt-1.5.14-1.fc13")
        self.assertIsNone(notice)

        self.assertEquals(len(uinfo.updates), 1)
        notice = uinfo.updates[0]

        self.assertIsNotNone(notice)
        self.assertEquals(notice.title, update.title)
        self.assertEquals(notice.release, update.release.long_name)
        self.assertEquals(notice.status, update.status.value)
        if update.date_modified:
            self.assertEquals(notice.updated_date, update.date_modified)
        self.assertEquals(notice.fromstr, config.get("bodhi_email"))
        self.assertEquals(notice.rights, config.get("updateinfo_rights"))
        self.assertEquals(notice.description, update.notes)
        # self.assertIsNotNone(notice.issued_date)
        self.assertEquals(notice.id, update.alias)
        bug = notice.references[0]
        self.assertEquals(bug.href, update.bugs[0].url)
        self.assertEquals(bug.id, "12345")
        self.assertEquals(bug.type, "bugzilla")
        cve = notice.references[1]
        self.assertEquals(cve.type, "cve")
        self.assertEquals(cve.href, update.cves[0].url)
        self.assertEquals(cve.id, update.cves[0].cve_id)

        col = notice.collections[0]
        self.assertEquals(col.name, update.release.long_name)
        self.assertEquals(col.shortname, update.release.name)

        pkg = col.packages[0]
        self.assertEquals(pkg.epoch, "0")
        self.assertEquals(pkg.name, "TurboGears")
        self.assertEquals(
            pkg.src,
            "https://download.fedoraproject.org/pub/fedora/linux/updates/testing/17/SRPMS/T/TurboGears-1.0.2.2-2.fc7.src.rpm",
        )
        self.assertEquals(pkg.version, "1.0.2.2")
        self.assertFalse(pkg.reboot_suggested)
        self.assertEquals(pkg.arch, "src")
        self.assertEquals(pkg.filename, "TurboGears-1.0.2.2-2.fc7.src.rpm")

    def test_extended_metadata_updating(self):
        update = self.db.query(Update).one()

        # Pretend it's pushed to testing
        update.status = UpdateStatus.testing
        update.request = None
        update.date_pushed = datetime.utcnow()
        DevBuildsys.__tagged__[update.title] = ["f17-updates-testing"]

        # Generate the XML
        md = ExtendedMetadata(update.release, update.request, self.db, self.temprepo)

        # Insert the updateinfo.xml into the repository
        md.insert_updateinfo()
        md.cache_repodata()

        updateinfo = self._verify_updateinfo(self.repodata)

        # Read an verify the updateinfo.xml.gz
        uinfo = createrepo_c.UpdateInfo(updateinfo)
        notice = self.get_notice(uinfo, update.title)

        self.assertIsNotNone(notice)
        self.assertEquals(notice.title, update.title)
        self.assertEquals(notice.release, update.release.long_name)
        self.assertEquals(notice.status, update.status.value)
        self.assertEquals(notice.updated_date, update.date_modified)
        self.assertEquals(notice.fromstr, config.get("bodhi_email"))
        self.assertEquals(notice.description, update.notes)
        # self.assertIsNotNone(notice.issued_date)
        self.assertEquals(notice.id, update.alias)
        # self.assertIsNone(notice.epoch)
        bug = notice.references[0]
        url = update.bugs[0].url
        self.assertEquals(bug.href, url)
        self.assertEquals(bug.id, "12345")
        self.assertEquals(bug.type, "bugzilla")
        cve = notice.references[1]
        self.assertEquals(cve.type, "cve")
        self.assertEquals(cve.href, update.cves[0].url)
        self.assertEquals(cve.id, update.cves[0].cve_id)

        # Change the notes on the update, but not the date_modified, so we can
        # ensure that the notice came from the cache
        update.notes = u"x"

        # Re-initialize our temporary repo
        shutil.rmtree(self.temprepo)
        os.mkdir(self.temprepo)
        mkmetadatadir(join(self.temprepo, "f17-updates-testing", "i386"))

        md = ExtendedMetadata(update.release, update.request, self.db, self.temprepo)
        md.insert_updateinfo()
        updateinfo = self._verify_updateinfo(self.repodata)

        # Read an verify the updateinfo.xml.gz
        uinfo = createrepo_c.UpdateInfo(updateinfo)
        notice = self.get_notice(uinfo, update.title)

        self.assertIsNotNone(notice)
        self.assertEquals(notice.description, u"Useful details!")  # not u'x'

    def test_metadata_updating_with_edited_update(self):
        update = self.db.query(Update).one()

        # Pretend it's pushed to testing
        update.status = UpdateStatus.testing
        update.request = None
        update.date_pushed = datetime.utcnow()
        DevBuildsys.__tagged__[update.title] = ["f17-updates-testing"]

        # Generate the XML
        md = ExtendedMetadata(update.release, update.request, self.db, self.temprepo)

        # Insert the updateinfo.xml into the repository
        md.insert_updateinfo()
        md.cache_repodata()

        updateinfo = self._verify_updateinfo(self.repodata)

        # Read an verify the updateinfo.xml.gz
        uinfo = createrepo_c.UpdateInfo(updateinfo)
        notice = self.get_notice(uinfo, update.title)

        self.assertIsNotNone(notice)
        self.assertEquals(notice.title, update.title)
        self.assertEquals(notice.release, update.release.long_name)
        self.assertEquals(notice.status, update.status.value)
        self.assertEquals(notice.updated_date, update.date_modified)
        self.assertEquals(notice.fromstr, config.get("bodhi_email"))
        self.assertEquals(notice.description, update.notes)
        self.assertIsNotNone(notice.issued_date)
        self.assertEquals(notice.id, update.alias)
        # self.assertIsNone(notice.epoch)
        bug = notice.references[0]
        self.assertEquals(bug.href, update.bugs[0].url)
        self.assertEquals(bug.id, "12345")
        self.assertEquals(bug.type, "bugzilla")
        cve = notice.references[1]
        self.assertEquals(cve.type, "cve")
        self.assertEquals(cve.href, update.cves[0].url)
        self.assertEquals(cve.id, update.cves[0].cve_id)

        # Change the notes on the update *and* the date_modified
        update.notes = u"x"
        update.date_modified = datetime.utcnow()

        # Re-initialize our temporary repo
        shutil.rmtree(self.temprepo)
        os.mkdir(self.temprepo)
        mkmetadatadir(join(self.temprepo, "f17-updates-testing", "i386"))

        md = ExtendedMetadata(update.release, update.request, self.db, self.temprepo)
        md.insert_updateinfo()
        updateinfo = self._verify_updateinfo(self.repodata)

        # Read an verify the updateinfo.xml.gz
        uinfo = createrepo_c.UpdateInfo(updateinfo)
        notice = self.get_notice(uinfo, update.title)

        self.assertIsNotNone(notice)
        self.assertEquals(notice.description, u"x")
        self.assertEquals(
            notice.updated_date.strftime("%Y-%m-%d %H:%M:%S"), update.date_modified.strftime("%Y-%m-%d %H:%M:%S")
        )

    def test_metadata_updating_with_old_stable_security(self):
        update = self.db.query(Update).one()
        update.request = None
        update.type = UpdateType.security
        update.status = UpdateStatus.stable
        update.date_pushed = datetime.utcnow()
        DevBuildsys.__tagged__[update.title] = ["f17-updates"]

        repo = join(self.tempdir, "f17-updates")
        mkmetadatadir(join(repo, "f17-updates", "i386"))
        self.repodata = join(repo, "f17-updates", "i386", "repodata")

        # Generate the XML
        md = ExtendedMetadata(update.release, UpdateRequest.stable, self.db, repo)

        # Insert the updateinfo.xml into the repository
        md.insert_updateinfo()
        md.cache_repodata()

        updateinfo = self._verify_updateinfo(self.repodata)

        # Read an verify the updateinfo.xml.gz
        uinfo = createrepo_c.UpdateInfo(updateinfo)
        notice = self.get_notice(uinfo, update.title)
        self.assertIsNotNone(notice)

        # Create a new non-security update for the same package
        newbuild = "bodhi-2.0-2.fc17"
        pkg = self.db.query(Package).filter_by(name=u"bodhi").one()
        build = Build(nvr=newbuild, package=pkg)
        self.db.add(build)
        self.db.flush()
        newupdate = Update(
            title=newbuild,
            type=UpdateType.enhancement,
            status=UpdateStatus.stable,
            request=None,
            release=update.release,
            builds=[build],
            notes=u"x",
        )
        newupdate.assign_alias()
        self.db.add(newupdate)
        self.db.flush()

        # Untag the old security build
        DevBuildsys.__untag__.append(update.title)
        DevBuildsys.__tagged__[newupdate.title] = [newupdate.release.stable_tag]
        buildrpms = DevBuildsys.__rpms__[0].copy()
        buildrpms["nvr"] = "bodhi-2.0-2.fc17"
        buildrpms["release"] = "2.fc17"
        DevBuildsys.__rpms__.append(buildrpms)

        # Re-initialize our temporary repo
        shutil.rmtree(repo)
        os.mkdir(repo)
        mkmetadatadir(join(repo, "f17-updates", "i386"))

        md = ExtendedMetadata(update.release, UpdateRequest.stable, self.db, repo)
        md.insert_updateinfo()
        updateinfo = self._verify_updateinfo(self.repodata)

        # Read an verify the updateinfo.xml.gz
        uinfo = createrepo_c.UpdateInfo(updateinfo)

        self.assertEquals(len(uinfo.updates), 2)

        notice = self.get_notice(uinfo, "bodhi-2.0-1.fc17")
        self.assertIsNotNone(notice)
        notice = self.get_notice(uinfo, "bodhi-2.0-2.fc17")
        self.assertIsNotNone(notice)

    def test_metadata_updating_with_old_testing_security(self):
        update = self.db.query(Update).one()
        update.request = None
        update.type = UpdateType.security
        update.status = UpdateStatus.testing
        update.date_pushed = datetime.utcnow()
        DevBuildsys.__tagged__[update.title] = ["f17-updates-testing"]

        # Generate the XML
        md = ExtendedMetadata(update.release, UpdateRequest.testing, self.db, self.temprepo)

        # Insert the updateinfo.xml into the repository
        md.insert_updateinfo()
        md.cache_repodata()

        updateinfo = self._verify_updateinfo(self.repodata)

        # Read an verify the updateinfo.xml.gz
        uinfo = createrepo_c.UpdateInfo(updateinfo)
        notice = self.get_notice(uinfo, update.title)
        self.assertIsNotNone(notice)

        # Create a new non-security update for the same package
        newbuild = "bodhi-2.0-2.fc17"
        pkg = self.db.query(Package).filter_by(name=u"bodhi").one()
        build = Build(nvr=newbuild, package=pkg)
        self.db.add(build)
        self.db.flush()
        newupdate = Update(
            title=newbuild,
            type=UpdateType.enhancement,
            status=UpdateStatus.testing,
            request=None,
            release=update.release,
            builds=[build],
            notes=u"x",
        )
        newupdate.assign_alias()
        self.db.add(newupdate)
        self.db.flush()

        # Untag the old security build
        del (DevBuildsys.__tagged__[update.title])
        DevBuildsys.__untag__.append(update.title)
        DevBuildsys.__tagged__[newupdate.title] = [newupdate.release.testing_tag]
        buildrpms = DevBuildsys.__rpms__[0].copy()
        buildrpms["nvr"] = "bodhi-2.0-2.fc17"
        buildrpms["release"] = "2.fc17"
        DevBuildsys.__rpms__.append(buildrpms)
        del (DevBuildsys.__rpms__[0])

        # Re-initialize our temporary repo
        shutil.rmtree(self.temprepo)
        os.mkdir(self.temprepo)
        mkmetadatadir(join(self.temprepo, "f17-updates-testing", "i386"))

        md = ExtendedMetadata(update.release, UpdateRequest.testing, self.db, self.temprepo)
        md.insert_updateinfo()
        updateinfo = self._verify_updateinfo(self.repodata)

        # Read an verify the updateinfo.xml.gz
        uinfo = createrepo_c.UpdateInfo(updateinfo)

        self.assertEquals(len(uinfo.updates), 1)
        notice = self.get_notice(uinfo, "bodhi-2.0-1.fc17")
        self.assertIsNone(notice)
        notice = self.get_notice(uinfo, "bodhi-2.0-2.fc17")
        self.assertIsNotNone(notice)