File tree Expand file tree Collapse file tree
functions-python/tasks_executor/tests/tasks/populate_licenses_and_rules Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22from unittest .mock import MagicMock , patch
33
44import requests
5+ from sqlalchemy .dialects .postgresql import JSONB
6+ from sqlalchemy .ext .compiler import compiles
57from shared .database .database import Session
68from shared .database_gen .sqlacodegen_models import License , Rule
79from tasks .licenses .populate_licenses import populate_licenses_task
810
11+
12+ # This compilation rule is necessary to make the JSONB type, which is PostgreSQL-specific,
13+ # compatible with the in-memory SQLite database used for testing. It tells SQLAlchemy
14+ # to treat JSONB as JSON when running against a SQLite backend.
15+ @compiles (JSONB , "sqlite" )
16+ def compile_jsonb_for_sqlite (element , compiler , ** kw ):
17+ return compiler .visit_json (element , ** kw )
18+
19+
920# Mock data for GitHub API responses
1021MOCK_LICENSE_LIST = [
1122 {
You can’t perform that action at this time.
0 commit comments