Files
WoW-Hybrid-gateway/tests/windows_source_auth_entry_test.py
praxisandClaude Fable 5.2 7f2139d8d0 Offline test fixtures
883 files, from working commit b1a079a.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-19 01:32:48 +02:00

37 lines
2.8 KiB
Python

"""Existing backend op37 private-memory adapter only; synthetic/no network/Game."""
import ctypes as C,json,struct,sys,unittest
from pathlib import Path
sys.path.insert(0,str(Path(__file__).resolve().parents[1]/'ops'))
import native_stream_local as m
class ExistingPrivateAuthRoute(unittest.TestCase):
def test_one_shot_existing_mailbox_and_backend_operations(self):
for case in ('success','auth-refused','close-error','bad-context','bad-mailbox'):
with self.subTest(case=case):
box=bytearray(132);user=b'PRIVATE_CANARY';password=b'SECRET_CANARY';struct.pack_into('<8I',box,0,1,132,1,1,len(user),len(password),0,0);box[32:32+len(user)]=user;box[65:65+len(password)]=password
if case=='bad-mailbox':struct.pack_into('<I',box,12,0)
root=Path('/owned-client');context={'profile':'praxis','hostname':'praxis.go.ro','public_endpoint':True,'expected':None,'endpoint_kind':1,'auth_port':3724,'auth_ipv4':'5.12.140.55','version':str(root/'compat/praxis/version-hash.bin')}
if case=='bad-context':context['hostname']='other.example'
operations=[]
def dispatch(pointer):
row=C.cast(pointer,C.POINTER(m.WireCall)).contents;operations.append(row.operation)
self.assertEqual((row.abi,row.size),(1,640))
if row.operation==37:
self.assertEqual(row.input_bytes,56);config=C.cast(row.input,C.POINTER(m.AuthIPv4)).contents
self.assertEqual((config.abi,config.size,config.port),(2,56,3724));self.assertEqual(C.string_at(config.username),user);self.assertEqual(C.string_at(config.password,config.password_bytes),password)
self.assertFalse(row.auth.username);self.assertFalse(row.auth.password)
if case=='auth-refused':row.result=-2
else:row.login=99
elif row.operation==3:row.value=1
elif row.operation==4:row.realm.name=b'FixtureRealm';row.realm.address=b'praxis.go.ro:8090'
elif row.operation==5:
if case=='close-error':raise RuntimeError('cleanup failure')
else:self.assertEqual(row.operation,2)
return 0
report=m.windows_source_auth_only(root,box,context,_dispatch=dispatch)
self.assertFalse(any(box));self.assertNotIn('CANARY',json.dumps(report));self.assertFalse(report['game_or_injection_used']);self.assertFalse(report['world_socket_opened'])
if case=='success':self.assertEqual(operations,[37,2,3,4,5]);self.assertTrue(report['server_proof_verified']);self.assertEqual(report['realms'][0]['address'],'praxis.go.ro:8090')
elif case=='close-error':self.assertEqual(operations,[37,2,3,4,5]);self.assertTrue(report['cleanup_failed']);self.assertTrue(report['server_proof_verified'])
elif case=='auth-refused':self.assertEqual(operations,[37]);self.assertFalse(report['server_proof_verified'])
else:self.assertEqual(operations,[]);self.assertFalse(report['auth_attempted'])
if __name__=='__main__':unittest.main()