def GetSavedOverrides(self): if not self.StatsExist(): raise PackageError("Package stats not ready.") pkg_stats = self.GetDbObject() res = m.CheckpkgOverride.select( m.CheckpkgOverride.q.srv4_file == pkg_stats) override_list = [] for db_override in res: d = { 'pkgname': db_override.pkgname, 'tag_name': db_override.tag_name, 'tag_info': db_override.tag_info, } override_list.append(overrides.Override(**d)) return override_list
def test_5(self): tags = [tag.CheckpkgTag("CSWfoo", "foo-tag", "tag-info-1")] oo = [overrides.Override("CSWfoo", "foo-tag", "tag-info-1")] self.assertEqual(([], set([])), overrides.ApplyOverrides(tags, oo))
def test_2(self): """One override, matching by tag name and tag info, no pkgname.""" tags = [tag.CheckpkgTag("CSWfoo", "foo-tag")] oo = [overrides.Override(None, "foo-tag", None)] self.assertEqual(([], set([])), overrides.ApplyOverrides(tags, oo))
def test_3(self): """One override, matching by tag name, mismatching tag info, no pkgname.""" tags = [tag.CheckpkgTag("CSWfoo", "foo-tag", "tag-info-1")] oo = [overrides.Override(None, "foo-tag", "tag-info-2")] self.assertEqual((tags, set(oo)), overrides.ApplyOverrides(tags, oo))
def test_6(self): """Pkgname mismatch.""" tags = [tag.CheckpkgTag("CSWfoo", "foo-tag", "tag-info-1")] oo = [overrides.Override("CSWbar", "foo-tag", "tag-info-1")] self.assertEqual((tags, set(oo)), overrides.ApplyOverrides(tags, oo))