diff --git a/backend/alembic/versions/55a49e4b7bc8_add_webhook_configs_table.py b/backend/alembic/versions/55a49e4b7bc8_add_webhook_configs_table.py index 1404c6800..d925f51ea 100644 --- a/backend/alembic/versions/55a49e4b7bc8_add_webhook_configs_table.py +++ b/backend/alembic/versions/55a49e4b7bc8_add_webhook_configs_table.py @@ -31,10 +31,11 @@ def upgrade() -> None: sa.Column('updated_at', sa.DateTime(), nullable=True), sa.ForeignKeyConstraint(['user_id'], ['users.id'], ), sa.PrimaryKeyConstraint('id'), + if_not_exists=True, ) - op.create_index(op.f('ix_webhook_configs_id'), 'webhook_configs', ['id'], unique=False) + op.create_index(op.f('ix_webhook_configs_id'), 'webhook_configs', ['id'], unique=False, if_not_exists=True) def downgrade() -> None: - op.drop_index(op.f('ix_webhook_configs_id'), table_name='webhook_configs') - op.drop_table('webhook_configs') + op.drop_index(op.f('ix_webhook_configs_id'), table_name='webhook_configs', if_exists=True) + op.drop_table('webhook_configs', if_exists=True) diff --git a/backend/alembic/versions/a7c004156ad1_add_ai_system_audit_logs_table.py b/backend/alembic/versions/a7c004156ad1_add_ai_system_audit_logs_table.py index f8cb1a7e6..637c75f6e 100644 --- a/backend/alembic/versions/a7c004156ad1_add_ai_system_audit_logs_table.py +++ b/backend/alembic/versions/a7c004156ad1_add_ai_system_audit_logs_table.py @@ -29,14 +29,15 @@ def upgrade() -> None: sa.Column('changed_at', sa.DateTime(), nullable=True), sa.ForeignKeyConstraint(['ai_system_id'], ['ai_systems.id'], ), sa.ForeignKeyConstraint(['changed_by_id'], ['users.id'], ), - sa.PrimaryKeyConstraint('id') + sa.PrimaryKeyConstraint('id'), + if_not_exists=True, ) - op.create_index(op.f('ix_ai_system_audit_logs_id'), 'ai_system_audit_logs', ['id'], unique=False) + op.create_index(op.f('ix_ai_system_audit_logs_id'), 'ai_system_audit_logs', ['id'], unique=False, if_not_exists=True) # ### end Alembic commands ### def downgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### - op.drop_index(op.f('ix_ai_system_audit_logs_id'), table_name='ai_system_audit_logs') - op.drop_table('ai_system_audit_logs') + op.drop_index(op.f('ix_ai_system_audit_logs_id'), table_name='ai_system_audit_logs', if_exists=True) + op.drop_table('ai_system_audit_logs', if_exists=True) # ### end Alembic commands ### diff --git a/tests/test_scan_prompts.py b/tests/test_scan_prompts.py index c1c0f9010..22704529b 100644 --- a/tests/test_scan_prompts.py +++ b/tests/test_scan_prompts.py @@ -38,6 +38,11 @@ def test_scan_prompts_blocks_malicious_prompt(tmp_path, monkeypatch): assert exit_code == 1 assert (tmp_path / "report.json").exists() + + client.post.assert_called_once() + + args, kwargs = client.post.call_args + assert "ignore all previous instructions" in str(kwargs) def test_scan_prompts_passes_clean_prompt(tmp_path, monkeypatch): @@ -65,4 +70,9 @@ def test_scan_prompts_passes_clean_prompt(tmp_path, monkeypatch): exit_code = module.main() assert exit_code == 0 - assert (tmp_path / "report.json").exists() \ No newline at end of file + assert (tmp_path / "report.json").exists() + + client.post.assert_called_once() + + args, kwargs = client.post.call_args + assert "Summarize the policy in three bullets." in str(kwargs) \ No newline at end of file