def mk_pkg(self,
               src_uri='',
               default_chksums={"size": 100},
               iuse='',
               disable_chksums=False):
        class fake_repo:
            def __init__(self, default_chksums):
                if disable_chksums:
                    self.chksums = {}
                else:
                    self.chksums = {}.fromkeys(
                        set(os.path.basename(x) for x in src_uri.split()),
                        default_chksums)

            def _get_digests(self, pkg, allow_missing=False):
                return False, self.chksums

        class fake_parent:
            _parent_repo = fake_repo(default_chksums)

        return misc.FakePkg('dev-util/diffball-2.7.1',
                            data={
                                'SRC_URI': src_uri,
                                'IUSE': iuse
                            },
                            parent=fake_parent())
Exemplo n.º 2
0
    def test_it(self):
        fake_pkg = misc.FakePkg("dev-util/diffball-0.5")
        fake_src = []
        fake_src.append("# This is our first fake ebuild\n")
        fake_src.append("\n")
        fake_src.append("\tinsinto /usr/bin\n")
        fake_src.append("\tinsinto /etc/env.d\n")
        fake_src.append("\tinsinto /etc/conf.d\n")
        fake_src.append("\tinsinto /etc/init.d/\n")
        fake_src.append("\tinsinto /etc/pam.d\n")
        fake_src.append("\tinsinto /usr/share/applications\n")
        fake_src.append("\tinsinto /usr/share/applications/\n")
        fake_src.append("\tinsinto //usr/share//applications//\n")
        fake_src.append("\tinsinto /etc/cron.d\n")
        fake_src.append("\tinsinto /etc/cron.hourly\n")
        fake_src.append("\tinsinto /etc/cron.daily\n")
        fake_src.append("\tinsinto /etc/cron.weekly\n")
        fake_src.append("# That's it for now\n")

        bad = (
            "/etc/env.d", "/etc/conf.d", "/etc/init.d", "/etc/pam.d",
            "/usr/share/applications", "/usr/share/applications",
            "//usr/share//applications", "/etc/cron.d", "/etc/cron.hourly",
            "/etc/cron.daily", "/etc/cron.weekly")
        check = BadInsIntoCheck(None, None)

        reports = self.assertReports(check, [fake_pkg, fake_src])
        dirs = [x.insintodir for x in reports]
        self.assertEqual(dirs, list(bad))
 def mk_pkg(self, attr, data='', eapi='0', iuse=''):
     return misc.FakePkg('dev-util/diffball-2.7.1',
                         data={
                             'EAPI': eapi,
                             'IUSE': iuse,
                             self.attr_map[attr]: data
                         })
Exemplo n.º 4
0
    def test_it(self):
        fake_pkg = misc.FakePkg("dev-util/diffball-0.5")
        fake_src = []
        fake_src.append("# This is our first fake ebuild\n")
        fake_src.append("# That's it for now")

        check = WhitespaceCheck(None, None)

        report = self.assertReports(check, [fake_pkg, fake_src])
        self.assertEqual(len(report), 1)
Exemplo n.º 5
0
    def test_it(self):
        fake_pkg = misc.FakePkg("dev-util/diffball-0.5")
        fake_src = []
        fake_src.append("# This is our first fake ebuild\n")
        fake_src.append(" # This line contains a leading whitespace\n")
        fake_src.append("# This line contains a trailing whitespace \n")
        fake_src.append("# This line contains a trailing tab\t\n")
        fake_src.append("\t \t#The first whitey is bad...\n")
        fake_src.append("\t\t #... the second one is fine\n")
        fake_src.append("\n")
        fake_src.append("\n")
        fake_src.append("# That's it for now\n")

        check = WhitespaceCheck(None, None)

        report = self.assertReports(check, [fake_pkg, fake_src])
        self.assertEqual(len(report), 4)
 def mk_pkg(self, ver, keywords=''):
     return misc.FakePkg("dev-util/diffball-%s" % ver,
                         data={"KEYWORDS": keywords})
 def mk_pkg(self, iuse=""):
     return misc.FakePkg("dev-util/diffball-0.7.1", data={"IUSE": iuse})
 def mk_pkg(self, keywords=""):
     return misc.FakePkg("dev-util/diffball-0.7.1",
                         data={"KEYWORDS": keywords})
 def mk_pkg(self, desc=""):
     return misc.FakePkg("dev-util/diffball-0.7.1",
                         data={"DESCRIPTION": desc})
 def mk_pkg(self, restrict=''):
     return misc.FakePkg('dev-util/diffball-2.7.1',
                         data={'RESTRICT': restrict})
Exemplo n.º 11
0
 def mk_pkg(self, ver, eclasses):
     return misc.FakePkg("dev-util/diffball-%s" % ver,
                         data={"_eclasses_": {}.fromkeys(eclasses)})
Exemplo n.º 12
0
 def mk_pkg(self, ver, key="dev-util/diffball"):
     return misc.FakePkg("%s-%s" % (key, ver))
Exemplo n.º 13
0
 def mk_pkg(self, ver, keywords=("x86", "amd64"), slot="0"):
     return misc.FakePkg(
         "dev-util/diffball-%s" % ver,
         data={"KEYWORDS": ' '.join(keywords), "SLOT": slot})