Bugzilla – Attachment 43599 Details for
Bug 13632
Make permission descriptions translatable
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13632: (QA followup) remove xt/permissions.t
Bug-13632-QA-followup-remove-xtpermissionst.patch (text/plain), 4.90 KB, created by
Tomás Cohen Arazi (tcohen)
on 2015-10-19 15:45:47 UTC
(
hide
)
Description:
Bug 13632: (QA followup) remove xt/permissions.t
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2015-10-19 15:45:47 UTC
Size:
4.90 KB
patch
obsolete
>From 1b5a3a026732b213181b988f004823bcbc1386a8 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 19 Oct 2015 12:42:59 -0300 >Subject: [PATCH] Bug 13632: (QA followup) remove xt/permissions.t > >There's no longer a need for this tests, as their goal was >to make sure en (the basis) was in sync with the translated >files. > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > xt/permissions.t | 141 ------------------------------------------------------- > 1 file changed, 141 deletions(-) > delete mode 100755 xt/permissions.t > >diff --git a/xt/permissions.t b/xt/permissions.t >deleted file mode 100755 >index 97d6ea7..0000000 >--- a/xt/permissions.t >+++ /dev/null >@@ -1,141 +0,0 @@ >-#!/usr/bin/perl >- >-# Copyright (C) 2010 Tamil s.a.r.l. >-# >-# This file is part of Koha. >-# >-# Koha is free software; you can redistribute it and/or modify it >-# under the terms of the GNU General Public License as published by >-# the Free Software Foundation; either version 3 of the License, or >-# (at your option) any later version. >-# >-# Koha is distributed in the hope that it will be useful, but >-# WITHOUT ANY WARRANTY; without even the implied warranty of >-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >-# GNU General Public License for more details. >-# >-# You should have received a copy of the GNU General Public License >-# along with Koha; if not, see <http://www.gnu.org/licenses>. >- >-use strict; >-use warnings; >- >-use Test::More qw(no_plan); >- >-use C4::Context; >- >-my $root_dir = 'installer/data/mysql'; >-my $base_perms_file = "en/mandatory/userpermissions.sql"; >-my @trans_perms_files = qw( >- de-DE/mandatory/userpermissions.sql >- it-IT/necessari/userpermissions.sql >- fr-FR/1-Obligatoire/userpermissions.sql >- uk-UA/mandatory/permissions_and_user_flags.sql >- ru-RU/mandatory/permissions_and_user_flags.sql >- pl-PL/mandatory/userpermissions.sql >- nb-NO/1-Obligatorisk/userpermissions.sql >- es-ES/mandatory/userpermissions.sql >-); >- >-ok( >- open( my $ref_fh, "<$root_dir/$base_perms_file" ), >- "Open reference user permissions file $root_dir/$base_perms_file" ); >-my $ref_perm = get_perms_from_file( $ref_fh ); >-my @ref_perms = sort { lc $a cmp lc $b } keys %$ref_perm; >-cmp_ok( >- $#ref_perms, '>=', 0, >- "Found " . ($#ref_perms + 1) . " user permissions" ); >- >-foreach my $file_name ( @trans_perms_files ) { >- compare_perms( $file_name ); >-} >- >- >-# >-# Get user permissions from SQL file populating permissions table with INSERT >-# statement. >-# >-# Example: >-# INSERT INTO permissions (module_bit, code, description) VALUES >-# ( 1, 'override_renewals', 'Override blocked renewals'), >-# >-sub get_perms_from_file { >- my $fh = shift; >- my %perm; >- my $found_insert = 0; >- while ( <$fh> ) { >- next if /^--/; # Comment line >- $found_insert = 1 if /insert\s+into/i and /permissions/i; >- next unless $found_insert; >- #/VALUES.*\(\'([\w\-:]+)\'/; >- /,\s*\'(.*?)\'/; >- my $variable = $1; >- next unless $variable; >- $perm{$variable} = 1; >- } >- return \%perm; >-} >- >- >-sub compare_perms { >- my $trans_file = shift; >- ok( >- open( my $trans_fh, "<$root_dir/$trans_file" ), >- "Open translated user permissions file $root_dir/$trans_file" ); >- my $trans_perm = get_perms_from_file( $trans_fh ); >- my @trans_perms = sort { lc $a cmp lc $b } keys %$trans_perm; >- cmp_ok( >- $#trans_perms, '>=', 0, >- "Found " . ($#trans_perms + 1) . " perms" ); >- >- my @to_add_perms; >- foreach ( @ref_perms ) { >- push @to_add_perms, $_ if ! $trans_perm->{$_}; >- } >- if ( $#to_add_perms >= 0 ) { >- fail( 'No user permissions to add') or diag( "User permissions to add in $trans_file: " . join(', ', @to_add_perms ) ); >- } >- else { >- pass( 'No user permissions to add' ); >- } >- >- my @to_delete_perms; >- foreach ( @trans_perms ) { >- push @to_delete_perms, $_ if ! $ref_perm->{$_}; >- } >- if ( $#to_delete_perms >= 0 ) { >- fail( 'No user permissions to delete' ); >- diag( "User permissions to delete in $trans_file: " . join(', ', @to_delete_perms ) ); >- diag( 'Warning: Some of those user permissions may rather have to be added to English permissions' ); >- } >- else { >- pass( 'No user permissions to delete' ); >- } >-} >- >- >-=head1 NAME >- >-permissions.t >- >-=head1 DESCRIPTION >- >-This test identifies incoherences between translated user permissions files and >-the 'en' reference file. >- >-Koha user permissions are loaded to 'permissions' table from a text SQL file >-during Koha installation by web installer. The reference file is the one >-provided for English (en) installation : >- >- <koha_root>/installer/data/mysql/en/mandatory/userpermissions.sql >- >-Alternatives files are provided for other languages. Those files >-are difficult to keep syncrhonized with reference file. >- >-=head1 USAGE >- >- prove -v permissions.t >- prove permissions.t >- >-=cut >- >-- >2.6.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 13632
:
35569
|
35595
|
35761
|
35776
|
42756
|
42757
|
42758
|
42759
|
42760
|
43528
|
43529
|
43530
|
43531
|
43532
|
43561
|
43562
|
43563
|
43564
|
43565
|
43566
| 43599