Skip to main content

Mock server for WGC QA framework: WGNI, WGCPS, CHUB API, Steam mocks on aiohttp

Project description

wgc-mocks

Full mock server for the WGC QA framework. Emulates all external services that Wargaming Game Center communicates with, including authentication (WGNI), commerce (WGCPS), content (CHUB API), and Steam integration.

Architecture

GameMocks (aiohttp async server)
├── HTTP  :8888
├── HTTPS :7771
│
├── WGNI (Wargaming Network Identity)
│   ├── OAuth token create/verify/revoke
│   ├── Account info (v2, v3)
│   ├── Two-factor authentication
│   ├── Challenge/captcha
│   └── Game ticket issue/consume
│
├── WGNR (Registration)
│   ├── Basic account creation
│   ├── Demo account creation
│   ├── Steam registration
│   └── Account activation
│
├── WGNP (Personal)
│   ├── Nickname change/validation
│   ├── Teleport (realm transfer)
│   ├── Signature management
│   └── Credentials management
│
├── WGCPS (Commerce)
│   ├── Product list (personal/global)
│   ├── Storefront categories
│   ├── Purchase prepare/commit
│   ├── Payment methods
│   ├── Bonus code redemption
│   ├── Notifications
│   └── Game page categories
│
├── CHUB API (Content)
│   ├── Content feed
│   ├── Game resources
│   └── Pages
│
├── Agate (Steam)
│   ├── Steam external payment init
│   └── Steam external payment commit
│
└── Update Service
    ├── Game patches / metadata
    └── Torrent files

Usage

from wgc_mocks import GameMocks

# Start mock server
await GameMocks.start()

# Mock handlers are swappable for testing error scenarios:
original = GameMocks.get_game_patch
async def error_handler(request):
    return web.Response(status=503)
GameMocks.get_game_patch = error_handler

# Restore
GameMocks.get_game_patch = original

WGNIUsersDB — in-memory user database

from wgc_mocks.wgni import WGNIUsersDB

# User management for mock auth
WGNIUsersDB.create_user(email='test@test.com', password='pass123')
user = WGNIUsersDB.get_user_by_email('test@test.com')

Key Features

  • Hot-swappable handlers — replace any mock handler in fixtures to simulate errors
  • Self-signed HTTPS — supports both HTTP and HTTPS with bundled certificates
  • WebSocket proxy — forwards WebSocket messages between test and WGC
  • Stateful — maintains user sessions, tokens, purchase state across requests
  • 60+ API routes mocked across WGNI, WGCPS, CHUB, and Agate

Install

pip install wgc-mocks

Dependencies

  • wgc-core — config, logger, exceptions
  • wgc-helpers — OS helpers, encryption, certificates
  • wgc-clippy — utilities
  • aiohttp — async HTTP server
  • nest-asyncio — nested event loop support

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wgc_mocks-4.0.1.tar.gz (229.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wgc_mocks-4.0.1-py3-none-any.whl (316.5 kB view details)

Uploaded Python 3

File details

Details for the file wgc_mocks-4.0.1.tar.gz.

File metadata

  • Download URL: wgc_mocks-4.0.1.tar.gz
  • Upload date:
  • Size: 229.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for wgc_mocks-4.0.1.tar.gz
Algorithm Hash digest
SHA256 68f34543592fb23d9ee4d6ce51e984f4edb2d64f04d212bfd97cddb90f203cb7
MD5 29fc1b6430b59893ed80183b959d8198
BLAKE2b-256 14b36479ba095d2b5511d50262ef721297d050b3369fb9389c05d3c02d848948

See more details on using hashes here.

File details

Details for the file wgc_mocks-4.0.1-py3-none-any.whl.

File metadata

  • Download URL: wgc_mocks-4.0.1-py3-none-any.whl
  • Upload date:
  • Size: 316.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for wgc_mocks-4.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ef35a43018a0fb2607589494984c708ca2e24677503296e774822b2db682c9f0
MD5 f36e3020ebf24aaffd303b17e85f676c
BLAKE2b-256 9a33b649a693cd0c341cf85d9a1e49a3510259e2a9392e57e1309523d2202ae4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page