def test_partial_pii_table(self): schema = Schema('public') table = Table(schema, 'partial_pii') table.add(Column('a')) table.add(Column('b')) table.scan(self.data_generator) self.assertTrue(table.has_pii()) cols = table.get_columns() self.assertTrue(cols[0].has_pii()) self.assertFalse(cols[1].has_pii()) self.assertEqual( { 'columns': [{ 'name': 'a', 'pii_types': [PiiTypes.PHONE] }, { 'name': 'b', 'pii_types': [] }], 'has_pii': True, 'name': 'partial_pii' }, table.get_dict())
def test_full_pii_table(self): schema = Schema('public') table = Table(schema, 'full_pii') table.add(Column('name')) table.add(Column('location')) table.scan(self.data_generator) self.assertTrue(table.has_pii()) cols = table.get_columns() self.assertTrue(cols[0].has_pii()) self.assertTrue(cols[1].has_pii()) self.assertEqual( { 'columns': [{ 'name': 'name', 'pii_types': [PiiTypes.PERSON] }, { 'name': 'location', 'pii_types': [PiiTypes.LOCATION] }], 'has_pii': True, 'name': 'full_pii' }, table.get_dict())
def test_partial_pii_table(self): schema = Schema('public') table = Table(schema, 'partial_pii') table.add(Column('fname')) table.add(Column('b')) table.shallow_scan() self.assertTrue(table.has_pii()) cols = table.get_columns() self.assertTrue(cols[0].has_pii()) self.assertFalse(cols[1].has_pii())