Fix masking tests

The masking filter now has a default fill value, so that if a
provided value does not match, then "X" is used.

The tests were modified to use "Y" as an explicitly provided
fill value (to distinguish from the default "X") and the results
were the default fill value would kick in were modified accordingly.
This commit is contained in:
Timofey Turenko
2017-06-26 12:18:48 +02:00
committed by Johan Wikman
parent 90ab2bc106
commit 9737ffe092
5 changed files with 43 additions and 43 deletions

View File

@ -5,7 +5,7 @@
"column": "a" "column": "a"
}, },
"with": { "with": {
"fill": "X" "fill": "Y"
} }
}, },
{ {
@ -22,7 +22,7 @@
}, },
"with": { "with": {
"value": "012345-ABCD", "value": "012345-ABCD",
"fill": "X" "fill": "Y"
} }
} }
] ]

View File

@ -11,12 +11,12 @@ insert into masking values ("hello", NULL, NULL);
insert into masking values (NULL, NULL, NULL); insert into masking values (NULL, NULL, NULL);
select * from masking; select * from masking;
a x y a x y
XXXXX hello hello YYYYY hello hello
NULL hello hello NULL hello hello
XXXXX NULL hello YYYYY NULL hello
XXXXX hello NULL YYYYY hello NULL
NULL NULL hello NULL NULL hello
XXXXX NULL NULL YYYYY NULL NULL
NULL NULL NULL NULL NULL NULL
drop table masking; drop table masking;
create table masking (x TEXT, a TEXT, y TEXT); create table masking (x TEXT, a TEXT, y TEXT);
@ -29,10 +29,10 @@ insert into masking values ("hello", NULL, NULL);
insert into masking values (NULL, NULL, NULL); insert into masking values (NULL, NULL, NULL);
select * from masking; select * from masking;
x a y x a y
hello XXXXX hello hello YYYYY hello
NULL XXXXX hello NULL YYYYY hello
hello NULL hello hello NULL hello
hello XXXXX NULL hello YYYYY NULL
NULL NULL hello NULL NULL hello
hello NULL NULL hello NULL NULL
NULL NULL NULL NULL NULL NULL
@ -47,11 +47,11 @@ insert into masking values ("hello", NULL, NULL);
insert into masking values (NULL, NULL, NULL); insert into masking values (NULL, NULL, NULL);
select * from masking; select * from masking;
x y a x y a
hello hello XXXXX hello hello YYYYY
NULL hello XXXXX NULL hello YYYYY
hello NULL XXXXX hello NULL YYYYY
hello hello NULL hello hello NULL
NULL NULL XXXXX NULL NULL YYYYY
hello NULL NULL hello NULL NULL
NULL NULL NULL NULL NULL NULL
drop table masking; drop table masking;

View File

@ -5,15 +5,15 @@ create table masking (a TEXT, b TEXT, c TEXT);
insert into masking values ("blah", "012345-ABC", "012345-ABC"); insert into masking values ("blah", "012345-ABC", "012345-ABC");
select * from masking; select * from masking;
a b c a b c
XXXX 012345-ABC XXXXXXXXXX YYYY XXXXXXXXXX YYYYYYYYYY
delete from masking; delete from masking;
insert into masking values ("blahblah", "221073-01AB", "012345-ABC"); insert into masking values ("blahblah", "221073-01AB", "012345-ABC");
select * from masking; select * from masking;
a b c a b c
XXXXXXXX 012345-ABCD XXXXXXXXXX YYYYYYYY 012345-ABCD YYYYYYYYYY
delete from masking; delete from masking;
insert into masking values ("221073-01AB", "221073-01AB", "221073-01AB"); insert into masking values ("221073-01AB", "221073-01AB", "221073-01AB");
select * from masking; select * from masking;
a b c a b c
XXXXXXXXXXX 012345-ABCD 012345-ABCD YYYYYYYYYYY 012345-ABCD 012345-ABCD
delete from masking; delete from masking;

View File

@ -31,46 +31,46 @@ insert into masking_ENUM values ("aaa");
insert into masking_SET values ("aaa"); insert into masking_SET values ("aaa");
select * from masking_BINARY; select * from masking_BINARY;
a a
XXX YYY
select * from masking_VARBINARY; select * from masking_VARBINARY;
a a
XXX YYY
select * from masking_CHAR; select * from masking_CHAR;
a a
XXX YYY
select * from masking_VARCHAR; select * from masking_VARCHAR;
a a
XXX YYY
select * from masking_BLOB; select * from masking_BLOB;
a a
XXX YYY
select * from masking_TINYBLOB; select * from masking_TINYBLOB;
a a
XXX YYY
select * from masking_MEDIUMBLOB; select * from masking_MEDIUMBLOB;
a a
XXX YYY
select * from masking_LONGBLOB; select * from masking_LONGBLOB;
a a
XXX YYY
select * from masking_TEXT; select * from masking_TEXT;
a a
XXX YYY
select * from masking_TINYTEXT; select * from masking_TINYTEXT;
a a
XXX YYY
select * from masking_MEDIUMTEXT; select * from masking_MEDIUMTEXT;
a a
XXX YYY
select * from masking_LONGTEXT; select * from masking_LONGTEXT;
a a
XXX YYY
select * from masking_ENUM; select * from masking_ENUM;
a a
XXX YYY
select * from masking_SET; select * from masking_SET;
a a
XXX YYY
create table masking_INT (a INT); create table masking_INT (a INT);
create table masking_REAL (a REAL(3, 2)); create table masking_REAL (a REAL(3, 2));
create table masking_DECIMAL (a DECIMAL(3, 2)); create table masking_DECIMAL (a DECIMAL(3, 2));

View File

@ -10,7 +10,7 @@
# "column": "a" # "column": "a"
# }, # },
# "with": { # "with": {
# "fill": "X" # "fill": "Y"
# } # }
# }, # },
# { # {
@ -27,7 +27,7 @@
# }, # },
# "with": { # "with": {
# "value": "012345-ABCD", # "value": "012345-ABCD",
# "fill": "X" # "fill": "Y"
# } # }
# } # }
# ] # ]
@ -46,38 +46,38 @@ use maskingdb;
# #
create table masking (a TEXT, b TEXT, c TEXT); create table masking (a TEXT, b TEXT, c TEXT);
# - a should be just "X...", # - a should be just "Y...",
# - b should be unchanged as the length does not match the string of "value", and # - b should be changed into "X..." as the length does not match and there is no
# there is no catch all "fill". # specific fill value, so the default "X" is used.
# - c should be just "X..." as the length does not match, so "value" is not applied # - c should be just "Y..." as the length does not match, so "value" is not applied
# and has "fill", which is applied. # and has "fill", which is applied.
# #
#a b c #a b c
#XXXX 012345-ABC XXXXXXXXXX #YYYY XXXXXXXXXX YYYYYYYYYY
insert into masking values ("blah", "012345-ABC", "012345-ABC"); insert into masking values ("blah", "012345-ABC", "012345-ABC");
select * from masking; select * from masking;
delete from masking; delete from masking;
# - a should be just "X...", # - a should be just "Y...",
# - b should be changed as the length matches the length of the string of "value" # - b should be changed as the length matches the length of the string of "value"
# - c should be just "X..." as the length does not match, so "value" is not applied # - c should be just "Y..." as the length does not match, so "value" is not applied
# and has "fill", which is applied. # and has "fill", which is applied.
# #
#a b c #a b c
#XXXXXXXX 012345-ABCD XXXXXXXXXX #YYYYYYYY 012345-ABCD YYYYYYYYYY
insert into masking values ("blahblah", "221073-01AB", "012345-ABC"); insert into masking values ("blahblah", "221073-01AB", "012345-ABC");
select * from masking; select * from masking;
delete from masking; delete from masking;
# - a should be just "X...", # - a should be just "Y...",
# - b should be changed as the length matches the length of the string of "value" # - b should be changed as the length matches the length of the string of "value"
# - c should be chanched into a specific string as the length matches the string of # - c should be chanched into a specific string as the length matches the string of
# "value" # "value"
# #
#a b c #a b c
#a b c #a b c
#XXXXXXXXXXX 012345-ABCD 012345-ABCD #YYYYYYYYYYY 012345-ABCD 012345-ABCD
# a should still be just "X", b should be "012345-ABCD" and c should be "012345-ABCD" # a should still be just "Y", b should be "012345-ABCD" and c should be "012345-ABCD"
insert into masking values ("221073-01AB", "221073-01AB", "221073-01AB"); insert into masking values ("221073-01AB", "221073-01AB", "221073-01AB");
select * from masking; select * from masking;
delete from masking; delete from masking;