Example #1
0
    def test_db_schema_after_build(self, mocker):
        connection = create_connection(":memory:")

        indexer = Indexer(connection, mocker.Mock())
        indexer.build_db()

        tables = map(
            lambda x: x[0],
            connection.execute("SELECT tbl_name FROM sqlite_master WHERE type='table'").fetchall())

        assert set(tables).issubset(["hashes", "files", "sqlite_sequence"])
Example #2
0
    def test_build_db(self, mocker):
        connection = mocker.MagicMock()

        indexer = Indexer(connection, mocker.Mock())
        indexer.build_db()
        assert connection.execute.call_count == 4