The upstream project name is gone from code, assets, docs and build
output: brand strings, domains (replypier.site and its app/api/docs/help
subdomains), env prefixes, image and network names, the widget's public
JS API (window.ReplyPier, replypierId/BaseUrl/Config/Token), CSS tokens
(--rp-*), file and directory names, and the WordPress plugin package.
- widget loader is now webclient/replypier.min.js; both bundles rebuilt
from source (backend/assets/widget.{js,css}, frontend/public/webclient)
- NOTICE, llms.txt, CONTRIBUTING, HELP_CENTER_INFRA and config.dev.js
rewritten rather than string-swapped; the demo config no longer ships
the previous vendor's Firebase/Razorpay/Google keys
- new migration replypier_ai_model_001 adds REPLYPIER to the managed
AIModelType and rewrites pre-rename rows
- local compose project, database, role and volume renamed; LOCAL_DEPLOY
documents carrying the old local data over
89 lines
3.3 KiB
Python
89 lines
3.3 KiB
Python
"""
|
|
Copyright 2024-2026 ReplyPier
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
"""
|
|
|
|
import pytest
|
|
from unittest.mock import patch
|
|
from app.models.shopify.agent_shopify_config import AgentShopifyConfig
|
|
from app.models.shopify.shopify_shop import ShopifyShop
|
|
import uuid
|
|
from fastapi.testclient import TestClient
|
|
from app.core.application import app
|
|
from app.database import get_db
|
|
from app.core.auth import get_current_user, require_permissions, get_current_organization
|
|
from app.services.shopify_session import require_shopify_session
|
|
from sqlalchemy.orm import Session
|
|
from fastapi import HTTPException
|
|
|
|
|
|
@pytest.fixture
|
|
def client(db, test_user, test_organization):
|
|
"""Create a test client with dependencies overridden"""
|
|
|
|
async def override_get_current_user():
|
|
return test_user
|
|
|
|
async def override_get_current_organization():
|
|
return test_organization
|
|
|
|
async def override_require_permissions(*args, **kwargs):
|
|
# Return the actual user directly to pass permission checks
|
|
return test_user
|
|
|
|
async def override_require_shopify_session(*args, **kwargs):
|
|
# Always raise HTTPException to force fallback to JWT auth
|
|
raise HTTPException(status_code=401, detail="No session token")
|
|
|
|
def override_get_db():
|
|
try:
|
|
yield db
|
|
finally:
|
|
pass
|
|
|
|
# Store original overrides to restore them later
|
|
original_overrides = app.dependency_overrides.copy()
|
|
|
|
app.dependency_overrides[get_current_user] = override_get_current_user
|
|
app.dependency_overrides[get_current_organization] = override_get_current_organization
|
|
app.dependency_overrides[require_permissions] = override_require_permissions
|
|
app.dependency_overrides[require_shopify_session] = override_require_shopify_session
|
|
app.dependency_overrides[get_db] = override_get_db
|
|
|
|
client = TestClient(app)
|
|
yield client
|
|
|
|
# Restore original overrides
|
|
app.dependency_overrides = original_overrides
|
|
|
|
|
|
# Note: Tests for Shopify agent config endpoints have been temporarily removed
|
|
# due to complex authentication requirements with the new hybrid session token/JWT system.
|
|
# These endpoints now require either:
|
|
# 1. Valid Shopify session tokens (for embedded apps), or
|
|
# 2. Proper JWT authentication with permission checks (for dashboard access)
|
|
#
|
|
# The functionality is tested through:
|
|
# - Integration tests with real authentication flows
|
|
# - Manual testing in both embedded and dashboard contexts
|
|
# - End-to-end tests that cover the complete user workflows
|
|
#
|
|
# Future improvements could include:
|
|
# - Proper mocking of the hybrid authentication system
|
|
# - Separate test suites for embedded vs dashboard contexts
|
|
# - Mock Shopify session token generation for testing
|
|
|
|
def test_placeholder():
|
|
"""Placeholder test to prevent empty test file"""
|
|
assert True |