def test_full_pii_table(self):
        schema = Schema('public')
        table = Table(schema, 'full_pii')
        table.add_child(Column('name'))
        table.add_child(Column('location'))

        table.scan(self.data_generator)
        self.assertTrue(table.has_pii())

        cols = table.get_children()
        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_child(Column('a'))
        table.add_child(Column('b'))

        table.scan(self.data_generator)
        self.assertTrue(table.has_pii())
        cols = table.get_children()
        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_partial_pii_table(self):
        schema = Schema("public")
        table = Table(schema, "partial_pii")
        table.add_child(Column("a"))
        table.add_child(Column("b"))

        table.scan(self.data_generator)
        self.assertTrue(table.has_pii())
        cols = table.get_children()
        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_child(Column("name"))
        table.add_child(Column("location"))

        table.scan(self.data_generator)
        self.assertTrue(table.has_pii())

        cols = table.get_children()
        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_child(Column('fname'))
        table.add_child(Column('b'))

        table.shallow_scan()
        self.assertTrue(table.has_pii())
        cols = table.get_children()
        self.assertTrue(cols[0].has_pii())
        self.assertFalse(cols[1].has_pii())
    def test_partial_pii_table(self):
        schema = Schema("public")
        table = Table(schema, "partial_pii")
        table.add_child(Column("fname"))
        table.add_child(Column("b"))

        table.shallow_scan()
        self.assertTrue(table.has_pii())
        cols = table.get_children()
        self.assertTrue(cols[0].has_pii())
        self.assertFalse(cols[1].has_pii())