def testParse(self):
        """Test parsing a valid file."""
        self.PatchObject(portage_util,
                         'FindOverlayFile',
                         return_value=self.acl_file)

        expected_acls = [['-g', 'group1:READ'], ['-u', 'user:FULL_CONTROL'],
                         ['-g', 'group2:READ']]

        acls = binhost.GetPrebuiltAclArgs(self.build_target)

        self.assertCountEqual(expected_acls, acls)
Ejemplo n.º 2
0
def GetPrivatePrebuiltAclArgs(input_proto, output_proto, _config):
    """Get the ACL args from the files in the private overlays."""
    build_target = build_target_util.BuildTarget(input_proto.build_target.name)

    try:
        args = binhost.GetPrebuiltAclArgs(build_target)
    except binhost.Error as e:
        cros_build_lib.Die(e)

    for arg, value in args:
        new_arg = output_proto.args.add()
        new_arg.arg = arg
        new_arg.value = value
    def testNoFile(self):
        """Test no file handling."""
        self.PatchObject(portage_util, 'FindOverlayFile', return_value=None)

        with self.assertRaises(binhost.NoAclFileFound):
            binhost.GetPrebuiltAclArgs(self.build_target)