How to use piicatcher - 10 common examples

To help you get started, we’ve selected a few piicatcher examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tokern / piicatcher / tests / test_file_explorer.py View on Github external
def scan(self):
        f1 = File("/tmp/1", "text/plain")
        f1._pii.add(PiiTypes.BIRTH_DATE)

        f2 = File("/tmp/2", "application/pdf")
        f2._pii.add(PiiTypes.UNSUPPORTED)

        self._files.append(f1)
        self._files.append(f2)
github tokern / piicatcher / tests / test_scanner.py View on Github external
def test_address(self):
        self.assertTrue(PiiTypes.ADDRESS in self.parser.scan("address"))
        self.assertTrue(PiiTypes.ADDRESS in self.parser.scan("city"))
        self.assertTrue(PiiTypes.ADDRESS in self.parser.scan("state"))
        self.assertTrue(PiiTypes.ADDRESS in self.parser.scan("country"))
        self.assertTrue(PiiTypes.ADDRESS in self.parser.scan("zipcode"))
        self.assertTrue(PiiTypes.ADDRESS in self.parser.scan("postal"))
github tokern / piicatcher / tests / test_explorer.py View on Github external
def setUp(self):
        self.explorer = MockExplorer(
            Namespace(
                host="mock_connection",
                include_schema=(),
                exclude_schema=(),
                include_table=(),
                exclude_table=(),
                catalog=None,
            )
        )

        col1 = Column("c1")
        col2 = Column("c2")
        col2._pii = [PiiTypes.LOCATION]

        schema = Schema("s1")
        table = Table(schema, "t1")
        table.add_child(col1)
        table.add_child(col2)

        schema = Schema("testSchema")
        schema.add_child(table)

        self.explorer._database = Database("database")
        self.explorer._database.add_child(schema)
github tokern / piicatcher / tests / test_scanner.py View on Github external
def test_location(self):
        types = self.parser.scan("Jonathan is in Bangalore")
        self.assertTrue(PiiTypes.LOCATION in types)
github tokern / piicatcher / tests / test_models.py View on Github external
def get_full_pii_table():
        full_pii_table = Table("test_store", "full_pii")
        full_pii_a = Column("a")
        full_pii_a.add_pii_type(PiiTypes.PHONE)
        full_pii_b = Column("b")
        full_pii_b.add_pii_type(PiiTypes.ADDRESS)
        full_pii_b.add_pii_type(PiiTypes.LOCATION)

        full_pii_table.add_child(full_pii_a)
        full_pii_table.add_child(full_pii_b)

        return full_pii_table
github tokern / piicatcher / tests / test_scanner.py View on Github external
def test_gender(self):
        self.assertTrue(PiiTypes.GENDER in self.parser.scan("gender"))
github tokern / piicatcher / tests / test_models.py View on Github external
def get_partial_pii_table():
        partial_pii_table = Table("test_store", "partial_pii")
        partial_pii_a = Column("a")
        partial_pii_a.add_pii_type(PiiTypes.PHONE)
        partial_pii_b = Column("b")
        partial_pii_b.add_pii_type(PiiTypes.ADDRESS)

        partial_pii_table.add_child(partial_pii_a)
        partial_pii_table.add_child(partial_pii_b)

        return partial_pii_table
github tokern / piicatcher / tests / test_models.py View on Github external
def get_partial_pii_table():
        partial_pii_table = Table("test_store", "partial_pii")
        partial_pii_a = Column("a")
        partial_pii_a.add_pii_type(PiiTypes.PHONE)
        partial_pii_b = Column("b")

        partial_pii_table.add_child(partial_pii_a)
        partial_pii_table.add_child(partial_pii_b)

        return partial_pii_table
github tokern / piicatcher / tests / test_models.py View on Github external
def get_partial_pii_table():
        partial_pii_table = Table("test_store", "partial_pii")
        partial_pii_a = Column("a")
        partial_pii_a.add_pii_type(PiiTypes.PHONE)
        partial_pii_b = Column("b")
        partial_pii_b.add_pii_type(PiiTypes.ADDRESS)

        partial_pii_table.add_child(partial_pii_a)
        partial_pii_table.add_child(partial_pii_b)

        return partial_pii_table
github tokern / piicatcher / tests / test_databases.py View on Github external
def setUp(self):
        col1 = Column("c1")
        col2 = Column("c2")
        col2._pii = [PiiTypes.LOCATION]

        self.schema = Schema("testSchema")

        table = Table(self.schema, "t1")
        table.add_child(col1)
        table.add_child(col2)

        self.schema.add_child(table)