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:

committed by
Johan Wikman

parent
90ab2bc106
commit
9737ffe092
@ -5,7 +5,7 @@
|
||||
"column": "a"
|
||||
},
|
||||
"with": {
|
||||
"fill": "X"
|
||||
"fill": "Y"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -22,7 +22,7 @@
|
||||
},
|
||||
"with": {
|
||||
"value": "012345-ABCD",
|
||||
"fill": "X"
|
||||
"fill": "Y"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
@ -11,12 +11,12 @@ insert into masking values ("hello", NULL, NULL);
|
||||
insert into masking values (NULL, NULL, NULL);
|
||||
select * from masking;
|
||||
a x y
|
||||
XXXXX hello hello
|
||||
YYYYY hello hello
|
||||
NULL hello hello
|
||||
XXXXX NULL hello
|
||||
XXXXX hello NULL
|
||||
YYYYY NULL hello
|
||||
YYYYY hello NULL
|
||||
NULL NULL hello
|
||||
XXXXX NULL NULL
|
||||
YYYYY NULL NULL
|
||||
NULL NULL NULL
|
||||
drop table masking;
|
||||
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);
|
||||
select * from masking;
|
||||
x a y
|
||||
hello XXXXX hello
|
||||
NULL XXXXX hello
|
||||
hello YYYYY hello
|
||||
NULL YYYYY hello
|
||||
hello NULL hello
|
||||
hello XXXXX NULL
|
||||
hello YYYYY NULL
|
||||
NULL NULL hello
|
||||
hello NULL NULL
|
||||
NULL NULL NULL
|
||||
@ -47,11 +47,11 @@ insert into masking values ("hello", NULL, NULL);
|
||||
insert into masking values (NULL, NULL, NULL);
|
||||
select * from masking;
|
||||
x y a
|
||||
hello hello XXXXX
|
||||
NULL hello XXXXX
|
||||
hello NULL XXXXX
|
||||
hello hello YYYYY
|
||||
NULL hello YYYYY
|
||||
hello NULL YYYYY
|
||||
hello hello NULL
|
||||
NULL NULL XXXXX
|
||||
NULL NULL YYYYY
|
||||
hello NULL NULL
|
||||
NULL NULL NULL
|
||||
drop table masking;
|
||||
|
@ -5,15 +5,15 @@ create table masking (a TEXT, b TEXT, c TEXT);
|
||||
insert into masking values ("blah", "012345-ABC", "012345-ABC");
|
||||
select * from masking;
|
||||
a b c
|
||||
XXXX 012345-ABC XXXXXXXXXX
|
||||
YYYY XXXXXXXXXX YYYYYYYYYY
|
||||
delete from masking;
|
||||
insert into masking values ("blahblah", "221073-01AB", "012345-ABC");
|
||||
select * from masking;
|
||||
a b c
|
||||
XXXXXXXX 012345-ABCD XXXXXXXXXX
|
||||
YYYYYYYY 012345-ABCD YYYYYYYYYY
|
||||
delete from masking;
|
||||
insert into masking values ("221073-01AB", "221073-01AB", "221073-01AB");
|
||||
select * from masking;
|
||||
a b c
|
||||
XXXXXXXXXXX 012345-ABCD 012345-ABCD
|
||||
YYYYYYYYYYY 012345-ABCD 012345-ABCD
|
||||
delete from masking;
|
||||
|
@ -31,46 +31,46 @@ insert into masking_ENUM values ("aaa");
|
||||
insert into masking_SET values ("aaa");
|
||||
select * from masking_BINARY;
|
||||
a
|
||||
XXX
|
||||
YYY
|
||||
select * from masking_VARBINARY;
|
||||
a
|
||||
XXX
|
||||
YYY
|
||||
select * from masking_CHAR;
|
||||
a
|
||||
XXX
|
||||
YYY
|
||||
select * from masking_VARCHAR;
|
||||
a
|
||||
XXX
|
||||
YYY
|
||||
select * from masking_BLOB;
|
||||
a
|
||||
XXX
|
||||
YYY
|
||||
select * from masking_TINYBLOB;
|
||||
a
|
||||
XXX
|
||||
YYY
|
||||
select * from masking_MEDIUMBLOB;
|
||||
a
|
||||
XXX
|
||||
YYY
|
||||
select * from masking_LONGBLOB;
|
||||
a
|
||||
XXX
|
||||
YYY
|
||||
select * from masking_TEXT;
|
||||
a
|
||||
XXX
|
||||
YYY
|
||||
select * from masking_TINYTEXT;
|
||||
a
|
||||
XXX
|
||||
YYY
|
||||
select * from masking_MEDIUMTEXT;
|
||||
a
|
||||
XXX
|
||||
YYY
|
||||
select * from masking_LONGTEXT;
|
||||
a
|
||||
XXX
|
||||
YYY
|
||||
select * from masking_ENUM;
|
||||
a
|
||||
XXX
|
||||
YYY
|
||||
select * from masking_SET;
|
||||
a
|
||||
XXX
|
||||
YYY
|
||||
create table masking_INT (a INT);
|
||||
create table masking_REAL (a REAL(3, 2));
|
||||
create table masking_DECIMAL (a DECIMAL(3, 2));
|
||||
|
@ -10,7 +10,7 @@
|
||||
# "column": "a"
|
||||
# },
|
||||
# "with": {
|
||||
# "fill": "X"
|
||||
# "fill": "Y"
|
||||
# }
|
||||
# },
|
||||
# {
|
||||
@ -27,7 +27,7 @@
|
||||
# },
|
||||
# "with": {
|
||||
# "value": "012345-ABCD",
|
||||
# "fill": "X"
|
||||
# "fill": "Y"
|
||||
# }
|
||||
# }
|
||||
# ]
|
||||
@ -46,38 +46,38 @@ use maskingdb;
|
||||
#
|
||||
create table masking (a TEXT, b TEXT, c TEXT);
|
||||
|
||||
# - a should be just "X...",
|
||||
# - b should be unchanged as the length does not match the string of "value", and
|
||||
# there is no catch all "fill".
|
||||
# - c should be just "X..." as the length does not match, so "value" is not applied
|
||||
# - a should be just "Y...",
|
||||
# - b should be changed into "X..." as the length does not match and there is no
|
||||
# specific fill value, so the default "X" is used.
|
||||
# - c should be just "Y..." as the length does not match, so "value" is not applied
|
||||
# and has "fill", which is applied.
|
||||
#
|
||||
#a b c
|
||||
#XXXX 012345-ABC XXXXXXXXXX
|
||||
#YYYY XXXXXXXXXX YYYYYYYYYY
|
||||
insert into masking values ("blah", "012345-ABC", "012345-ABC");
|
||||
select * 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"
|
||||
# - 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.
|
||||
#
|
||||
#a b c
|
||||
#XXXXXXXX 012345-ABCD XXXXXXXXXX
|
||||
#YYYYYYYY 012345-ABCD YYYYYYYYYY
|
||||
insert into masking values ("blahblah", "221073-01AB", "012345-ABC");
|
||||
select * 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"
|
||||
# - c should be chanched into a specific string as the length matches the string of
|
||||
# "value"
|
||||
#
|
||||
#a b c
|
||||
#a b c
|
||||
#XXXXXXXXXXX 012345-ABCD 012345-ABCD
|
||||
# a should still be just "X", b should be "012345-ABCD" and c should be "012345-ABCD"
|
||||
#YYYYYYYYYYY 012345-ABCD 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");
|
||||
select * from masking;
|
||||
delete from masking;
|
||||
|
Reference in New Issue
Block a user